|
@@ -979,6 +979,7 @@ onMounted(() => {
|
|
|
meta2d.on('fit',fit);
|
|
|
meta2d.on('scale', scaleSubscriber);
|
|
|
meta2d.on('add', lineAdd);
|
|
|
+ meta2d.on('add', penAdd);
|
|
|
meta2d.on('opened', openedListener);
|
|
|
|
|
|
meta2d.on('undo', patchFlag);
|
|
@@ -1008,6 +1009,7 @@ onUnmounted(()=>{
|
|
|
meta2d.off('fit',fit);
|
|
|
meta2d.off('scale', scaleSubscriber);
|
|
|
meta2d.off('add', lineAdd);
|
|
|
+ meta2d.off('add', penAdd);
|
|
|
meta2d.off('opened', openedListener);
|
|
|
|
|
|
meta2d.off('undo', patchFlag);
|
|
@@ -1412,7 +1414,10 @@ const onPencil = () => {
|
|
|
}
|
|
|
pencil.value = meta2d.canvas.pencil;
|
|
|
}
|
|
|
-
|
|
|
+const penAdd = (pen:Pen)=>{
|
|
|
+ // 画布新增一个pen,就需要根据当前主题调用setTheme
|
|
|
+ pen[0].setTheme && pen[0].setTheme(pen[0],meta2d.store.styles);
|
|
|
+}
|
|
|
const lineAdd = (pens: Pen[]) => {
|
|
|
if (pens.length === 1 && pens[0].name === 'line') {
|
|
|
//连线类型
|