|
@@ -189,35 +189,37 @@ export const useShapesIcon = (
|
|
|
const unMountMap = new WeakMap<EntityShape, () => void>();
|
|
|
|
|
|
const pause = usePause();
|
|
|
- const stop = watch([shapes, () => pause.isPause], ([shapes], [oldShapes]) => {
|
|
|
- if (pause.isPause) {
|
|
|
- shapes = [];
|
|
|
- }
|
|
|
-
|
|
|
- const { added, deleted } = diffArrayChange(shapes || [], oldShapes || []);
|
|
|
- for (const addShape of added) {
|
|
|
- const mat = ref(getShapeMat(addShape));
|
|
|
- const data = reactive({ ...iconProps, mat: mat });
|
|
|
- const update = frameEebounce(() => {
|
|
|
- data.width = invConfig.value.scaleX * iconProps.width;
|
|
|
- data.height = invConfig.value.scaleY * iconProps.height;
|
|
|
- mat.value = getShapeMat(addShape);
|
|
|
- });
|
|
|
- const unHooks = [
|
|
|
- on(addShape, update),
|
|
|
- watch(invConfig, update, { immediate: true, flush: "post" }),
|
|
|
- mParts.add({
|
|
|
- comp: markRaw(Icon),
|
|
|
- props: { data },
|
|
|
- }),
|
|
|
- ];
|
|
|
- unMountMap.set(addShape, mergeFuns(unHooks));
|
|
|
- }
|
|
|
- for (const delShape of deleted) {
|
|
|
- const fn = unMountMap.get(delShape);
|
|
|
- fn && fn();
|
|
|
+ const stop = watch(
|
|
|
+ [() => [...(shapes.value || [])], () => pause.isPause],
|
|
|
+ ([shapes], [oldShapes]) => {
|
|
|
+ if (pause.isPause) {
|
|
|
+ shapes = [];
|
|
|
+ }
|
|
|
+ const { added, deleted } = diffArrayChange(shapes || [], oldShapes || []);
|
|
|
+ for (const addShape of added) {
|
|
|
+ const mat = ref(getShapeMat(addShape));
|
|
|
+ const data = reactive({ ...iconProps, mat: mat });
|
|
|
+ const update = frameEebounce(() => {
|
|
|
+ data.width = invConfig.value.scaleX * iconProps.width;
|
|
|
+ data.height = invConfig.value.scaleY * iconProps.height;
|
|
|
+ mat.value = getShapeMat(addShape);
|
|
|
+ });
|
|
|
+ const unHooks = [
|
|
|
+ on(addShape, update),
|
|
|
+ watch(invConfig, update, { immediate: true, flush: "post" }),
|
|
|
+ mParts.add({
|
|
|
+ comp: markRaw(Icon),
|
|
|
+ props: { data },
|
|
|
+ }),
|
|
|
+ ];
|
|
|
+ unMountMap.set(addShape, mergeFuns(unHooks));
|
|
|
+ }
|
|
|
+ for (const delShape of deleted) {
|
|
|
+ const fn = unMountMap.get(delShape);
|
|
|
+ fn && fn();
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ );
|
|
|
return [stop, pause];
|
|
|
};
|
|
|
|
|
@@ -238,9 +240,9 @@ export const useStoreSelectionManage = installGlobalVar((): SelectionManage => {
|
|
|
const canSelect = (shape: EntityShape) => {
|
|
|
const id = shape.id();
|
|
|
if (!id) {
|
|
|
- return false
|
|
|
+ return false;
|
|
|
}
|
|
|
- const item = store.items.find((item) => item.id === id)
|
|
|
+ const item = store.items.find((item) => item.id === id);
|
|
|
return !!(item && !item.lock);
|
|
|
};
|
|
|
const listener = (shape: EntityShape) => {
|
|
@@ -347,11 +349,15 @@ export const useSelectionRevise = () => {
|
|
|
};
|
|
|
const operMode = useOperMode();
|
|
|
const layer = useFormalLayer();
|
|
|
- watch(() => operMode.value.mulSelection, (muls, olv) => {
|
|
|
- if (muls) {
|
|
|
- status.selects = [...status.selects, ...status.actives]
|
|
|
- }
|
|
|
- }, {flush: 'pre'})
|
|
|
+ watch(
|
|
|
+ () => operMode.value.mulSelection,
|
|
|
+ (muls, olv) => {
|
|
|
+ if (muls) {
|
|
|
+ status.selects = [...status.selects, ...status.actives];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { flush: "pre" }
|
|
|
+ );
|
|
|
watch(
|
|
|
() => [!!ids.value.length, operMode.value.mulSelection],
|
|
|
(_a, _b) => {
|