@trafica/editor 1.0.51 → 1.0.52
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 +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8653,8 +8653,10 @@ function EditorCore({
|
|
|
8653
8653
|
const figH = (fig == null ? void 0 : fig.offsetHeight) || drag.ghostH;
|
|
8654
8654
|
const rawX = e.clientX - cr.left - drag.offsetX + container.scrollLeft;
|
|
8655
8655
|
const rawY = e.clientY - cr.top - drag.offsetY + container.scrollTop;
|
|
8656
|
+
const editorH = editorRootRef.current ? editorRootRef.current.offsetHeight - (cr.top - editorRootRef.current.getBoundingClientRect().top) : container.offsetHeight;
|
|
8657
|
+
const maxH = Math.max(container.offsetHeight, editorH);
|
|
8656
8658
|
const x = Math.max(0, Math.min(rawX, container.clientWidth - figW));
|
|
8657
|
-
const y = Math.max(0, Math.min(rawY,
|
|
8659
|
+
const y = Math.max(0, Math.min(rawY, maxH - figH));
|
|
8658
8660
|
if (fig) {
|
|
8659
8661
|
fig.style.position = "absolute";
|
|
8660
8662
|
fig.style.left = `${x}px`;
|
|
@@ -8680,8 +8682,10 @@ function EditorCore({
|
|
|
8680
8682
|
const figH = (fig == null ? void 0 : fig.offsetHeight) || drag.ghostH;
|
|
8681
8683
|
const rawX = e.clientX - cr.left - drag.offsetX + container.scrollLeft;
|
|
8682
8684
|
const rawY = e.clientY - cr.top - drag.offsetY + container.scrollTop;
|
|
8685
|
+
const editorH = editorRootRef.current ? editorRootRef.current.offsetHeight - (cr.top - editorRootRef.current.getBoundingClientRect().top) : container.offsetHeight;
|
|
8686
|
+
const maxH = Math.max(container.offsetHeight, editorH);
|
|
8683
8687
|
const x = Math.max(0, Math.min(rawX, container.clientWidth - figW));
|
|
8684
|
-
const y = Math.max(0, Math.min(rawY,
|
|
8688
|
+
const y = Math.max(0, Math.min(rawY, maxH - figH));
|
|
8685
8689
|
setImageAttr(drag.imagePath, { x: Math.round(x), y: Math.round(y) })(engine);
|
|
8686
8690
|
};
|
|
8687
8691
|
document.addEventListener("mousemove", onMouseMove);
|