@widgetic/canvas 0.5.17 → 0.5.18

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.
@@ -2427,6 +2427,15 @@
2427
2427
  });
2428
2428
 
2429
2429
  // Listen for scaling updates during drag
2430
+ const flushWidgetPreviewOverlay = () => {
2431
+ if (!onAfterRender) return;
2432
+ try {
2433
+ onAfterRender();
2434
+ } catch (err) {
2435
+ canvasWarn('Canvas: onAfterRender failed', err);
2436
+ }
2437
+ };
2438
+
2430
2439
  canvas.on('object:scaling', (opt: any) => {
2431
2440
  isCurrentlyScaling = true;
2432
2441
  scalingTarget = opt.target;
@@ -3118,6 +3127,7 @@
3118
3127
  // object:modified fires once at mouseup — ideal for undo snapshots.
3119
3128
  // Also fires after arrow-key nudges.
3120
3129
  canvas.on('object:modified', () => {
3130
+ flushWidgetPreviewOverlay();
3121
3131
  takeHistorySnapshot();
3122
3132
  });
3123
3133
 
@@ -4904,14 +4914,15 @@
4904
4914
  let afterRenderRaf = 0;
4905
4915
  canvas.on('after:render', () => {
4906
4916
  if (!onAfterRender) return;
4917
+ // While the pointer is resizing, the iframe has to match this paint.
4918
+ if (isCurrentlyScaling) {
4919
+ flushWidgetPreviewOverlay();
4920
+ return;
4921
+ }
4907
4922
  if (afterRenderRaf) return;
4908
4923
  afterRenderRaf = requestAnimationFrame(() => {
4909
4924
  afterRenderRaf = 0;
4910
- try {
4911
- onAfterRender?.();
4912
- } catch (err) {
4913
- canvasWarn('Canvas: onAfterRender failed', err);
4914
- }
4925
+ flushWidgetPreviewOverlay();
4915
4926
  });
4916
4927
  });
4917
4928
 
@@ -23,14 +23,11 @@ export function getWidgetPreviewGeometry(object, canvas, canvasElement) {
23
23
  ? object.calcTransformMatrix()
24
24
  : null;
25
25
  if (!sceneMatrix) return null;
26
- const dimensions = typeof object._getTransformedDimensions === 'function'
27
- ? object._getTransformedDimensions()
28
- : {
29
- x: (object.width || 1) * (object.scaleX || 1),
30
- y: (object.height || 1) * (object.scaleY || 1),
31
- };
32
- const halfWidth = dimensions.x / 2;
33
- const halfHeight = dimensions.y / 2;
26
+ // Local half-size only. calcTransformMatrix already applies scaleX/scaleY,
27
+ // so feeding it the scaled size makes the iframe lag the selection stroke
28
+ // and finish smaller or larger than the shape.
29
+ const halfWidth = (object.width || 1) / 2;
30
+ const halfHeight = (object.height || 1) / 2;
34
31
  const scenePoint = (x, y) => ({
35
32
  x: sceneMatrix[0] * x + sceneMatrix[2] * y + sceneMatrix[4],
36
33
  y: sceneMatrix[1] * x + sceneMatrix[3] * y + sceneMatrix[5],
@@ -47,7 +47,7 @@
47
47
  // Base tooltip styles
48
48
  Object.assign(tooltipBodyEl.style, {
49
49
  position: 'fixed',
50
- zIndex: '99999',
50
+ zIndex: '100000010',
51
51
  pointerEvents: 'none',
52
52
  display: 'none',
53
53
  background: '#1f2937',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/canvas",
3
- "version": "0.5.17",
3
+ "version": "0.5.18",
4
4
  "type": "module",
5
5
  "svelte": "./dist/index.js",
6
6
  "module": "./dist/index.js",