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