mce 0.15.22 → 0.15.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5287,8 +5287,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5287
5287
  const cloend = renderEngine.value.input._clonePointerEvent(event);
5288
5288
  cloend.srcElement = drawboardDom.value;
5289
5289
  cloend.target = frame.value;
5290
+ cloend.__FORM__ = event.target;
5290
5291
  exec("startPointerdown", cloend, {
5291
- allowRootFrame: true
5292
+ allowTopFrame: true
5292
5293
  });
5293
5294
  }
5294
5295
  }
@@ -11959,7 +11960,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
11959
11960
  t,
11960
11961
  exec
11961
11962
  } = useEditor();
11962
- const isActive = computed(() => !viewportAabb.value.overlap(selectionAabb.value));
11963
+ const isActive = computed(() => {
11964
+ return selectionAabb.value.width && selectionAabb.value.height && !viewportAabb.value.overlap(selectionAabb.value);
11965
+ });
11963
11966
  return (_ctx, _cache) => {
11964
11967
  return isActive.value ? (openBlock(), createElementBlock("div", {
11965
11968
  key: 0,
@@ -15555,8 +15558,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
15555
15558
  } = useEditor();
15556
15559
  const transformable = useTemplateRef("transformableTpl");
15557
15560
  const startContext = ref({});
15561
+ const currentEvent = ref();
15558
15562
  onBeforeMount(() => {
15559
- registerCommand({ command: "startTransform", handle: (e) => Boolean(transformable.value?.start(e)) });
15563
+ registerCommand({
15564
+ command: "startTransform",
15565
+ handle: (event) => {
15566
+ currentEvent.value = event;
15567
+ Boolean(transformable.value?.start(event));
15568
+ }
15569
+ });
15560
15570
  });
15561
15571
  onBeforeUnmount(() => {
15562
15572
  unregisterCommand("startTransform");
@@ -15687,13 +15697,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
15687
15697
  }
15688
15698
  return false;
15689
15699
  });
15690
- handleDragOutReparent(
15691
- element,
15692
- {
15693
- ...startContext.value[element.instanceId],
15694
- pointer: getGlobalPointer()
15695
- }
15696
- );
15700
+ if (handle === "move" && !currentEvent.value?.__FORM__) {
15701
+ handleDragOutReparent(
15702
+ element,
15703
+ {
15704
+ ...startContext.value[element.instanceId],
15705
+ pointer: getGlobalPointer()
15706
+ }
15707
+ );
15708
+ }
15697
15709
  });
15698
15710
  }
15699
15711
  });
@@ -16211,10 +16223,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16211
16223
  return;
16212
16224
  }
16213
16225
  const {
16214
- allowRootFrame = false
16226
+ allowTopFrame = false
16215
16227
  } = options;
16216
16228
  function isIncluded(node) {
16217
- return isElement(node) && !isLock(node) && (allowRootFrame || !isTopFrame(node)) && !node.findAncestor((ancestor) => isLock(ancestor));
16229
+ return isElement(node) && !isLock(node) && (allowTopFrame || !isTopFrame(node)) && !node.findAncestor((ancestor) => isLock(ancestor));
16218
16230
  }
16219
16231
  const drawing = state.value === "drawing";
16220
16232
  const hand = state.value === "hand";
@@ -3,7 +3,7 @@ import type { AxisAlignedBoundingBox } from '../types';
3
3
  declare global {
4
4
  namespace Mce {
5
5
  interface StartPointerdownOptions {
6
- allowRootFrame?: boolean;
6
+ allowTopFrame?: boolean;
7
7
  }
8
8
  interface Commands {
9
9
  startPointerdown: (e: PointerInputEvent, options?: StartPointerdownOptions) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.15.22",
4
+ "version": "0.15.24",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",