@widgetic/canvas 0.5.12 → 0.5.13
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.
|
@@ -5706,6 +5706,8 @@
|
|
|
5706
5706
|
// decide drag-bar visibility. Hover also selects a WidgetShape that
|
|
5707
5707
|
// has no live iframe yet (same selection path as click) — pointer
|
|
5708
5708
|
// then selects the iframe itself via the overlay's focus bridge.
|
|
5709
|
+
canvas.on('mouse:down', () => { canvasPointerInteractionActive = true; });
|
|
5710
|
+
canvas.on('mouse:up', () => { canvasPointerInteractionActive = false; });
|
|
5709
5711
|
canvas.on('mouse:over', (hoverEvt: any) => {
|
|
5710
5712
|
const target = hoverEvt?.target as any;
|
|
5711
5713
|
if (!target?._isWidgetImage || !target._widgetId || target._widgetOrphaned) return;
|
|
@@ -7743,15 +7745,31 @@ function checkAndAddNewShapeToFrame(shape: any) {
|
|
|
7743
7745
|
|
|
7744
7746
|
/** Hover tracking for WidgetShape overlays (W3 drag bar) + hover-select. */
|
|
7745
7747
|
let hoveredWidgetShapeId: string | null = null;
|
|
7748
|
+
/**
|
|
7749
|
+
* True from `mouse down` on the Fabric canvas until `mouse:up` — covers plain
|
|
7750
|
+
* object drags, pans and FreeTransform. Any hover-select must stay off while
|
|
7751
|
+
* this is set, otherwise dragging one shape across another selects the shape
|
|
7752
|
+
* the pointer happens to pass over.
|
|
7753
|
+
*/
|
|
7754
|
+
let canvasPointerInteractionActive = false;
|
|
7755
|
+
/** Hover-select must also yield while the overlay drag bar moves a WidgetShape. */
|
|
7756
|
+
let widgetShapeOverlayDragActive = false;
|
|
7746
7757
|
/** Suppress hover-select while a Fabric transform (drag/resize/rotate) is active. */
|
|
7747
7758
|
function isWidgetShapeHoverSelectBlocked(): boolean {
|
|
7748
7759
|
if (!canvas) return true;
|
|
7749
7760
|
if (activeTool !== 'select') return true;
|
|
7750
7761
|
if ((canvas as any)._currentTransform) return true;
|
|
7762
|
+
if (canvasPointerInteractionActive) return true;
|
|
7763
|
+
if (widgetShapeOverlayDragActive) return true;
|
|
7751
7764
|
if (activeEditingTextbox?.isEditing) return true;
|
|
7752
7765
|
return false;
|
|
7753
7766
|
}
|
|
7754
7767
|
|
|
7768
|
+
/** Exported for the host overlay: report its chrome drag-bar drags. */
|
|
7769
|
+
export function setWidgetShapeOverlayDragActive(active: boolean): void {
|
|
7770
|
+
widgetShapeOverlayDragActive = active;
|
|
7771
|
+
}
|
|
7772
|
+
|
|
7755
7773
|
/** Apply hover state change + notify the host overlay layer. */
|
|
7756
7774
|
function setHoveredWidgetShape(widgetId: string | null): void {
|
|
7757
7775
|
if (hoveredWidgetShapeId === widgetId) return;
|
|
@@ -110,6 +110,7 @@ declare const __propDef: {
|
|
|
110
110
|
getPrimaryWidgetId?: () => string | null;
|
|
111
111
|
translateWidgetShapeByScreen?: (widgetId: string, dxScreen: number, dyScreen: number) => boolean;
|
|
112
112
|
commitWidgetShapeTranslate?: (widgetId?: string | null) => void;
|
|
113
|
+
setWidgetShapeOverlayDragActive?: (active: boolean) => void;
|
|
113
114
|
selectWidgetShapeById?: (widgetId: string) => boolean;
|
|
114
115
|
getSelectedWidgetShapeId?: () => string | null;
|
|
115
116
|
getHoveredWidgetShapeId?: () => string | null;
|
|
@@ -210,6 +211,7 @@ export default class Canvas extends SvelteComponentTyped<CanvasProps, CanvasEven
|
|
|
210
211
|
get getPrimaryWidgetId(): () => string | null;
|
|
211
212
|
get translateWidgetShapeByScreen(): (widgetId: string, dxScreen: number, dyScreen: number) => boolean;
|
|
212
213
|
get commitWidgetShapeTranslate(): (widgetId?: string | null) => void;
|
|
214
|
+
get setWidgetShapeOverlayDragActive(): (active: boolean) => void;
|
|
213
215
|
get selectWidgetShapeById(): (widgetId: string) => boolean;
|
|
214
216
|
get getSelectedWidgetShapeId(): () => string | null;
|
|
215
217
|
get getHoveredWidgetShapeId(): () => string | null;
|