pict-section-flow 2.0.1 → 2.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-flow",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Pict Section Flow Diagram",
5
5
  "main": "source/Pict-Section-Flow.js",
6
6
  "scripts": {
@@ -962,6 +962,14 @@ class PictProviderFlowCSS extends libFableServiceProviderBase
962
962
  .pict-flow-panel-titlebar.dragging {
963
963
  cursor: grabbing;
964
964
  }
965
+ /* While a panel's foreignObject is dragged or resized, its x/y/height are rewritten on every
966
+ pointermove. A box-shadow on the HTML panel bleeds past the foreignObject box, and that bled
967
+ region is not in the per-move dirty rect, so the browser smears a copy of the shadow at the
968
+ old position (the "stuck shadow"). Drop the shadow for the duration of the gesture so there
969
+ is nothing to leave behind; it returns in place the moment the drag ends. */
970
+ .pict-flow-panel-foreign-object.pict-flow-panel-dragging .pict-flow-panel {
971
+ box-shadow: none;
972
+ }
965
973
  .pict-flow-panel-title-text {
966
974
  font-weight: 600;
967
975
  font-size: 12px;
@@ -985,6 +985,20 @@ class PictServiceFlowInteractionManager extends libFableServiceProviderBase
985
985
 
986
986
  // ---- Panel Dragging ----
987
987
 
988
+ // Toggle a "gesture in progress" marker on a panel's foreignObject. The panel CSS drops the
989
+ // panel box-shadow while this class is present: dragging/resizing rewrites the foreignObject
990
+ // geometry every pointermove, and the shadow (which bleeds outside the foreignObject box) would
991
+ // otherwise be smeared in place at each old position. No shadow during the gesture means none to
992
+ // leave behind; it returns when the class is removed at the end of the drag.
993
+ _setPanelGestureActive(pPanelHash, pIsActive)
994
+ {
995
+ if (!pPanelHash || !this._FlowView || !this._FlowView._PanelsLayer) { return; }
996
+ let tmpForeignObject = this._FlowView._PanelsLayer.querySelector('[data-panel-hash="' + pPanelHash + '"]');
997
+ if (!tmpForeignObject) { return; }
998
+ if (pIsActive) { tmpForeignObject.classList.add('pict-flow-panel-dragging'); }
999
+ else { tmpForeignObject.classList.remove('pict-flow-panel-dragging'); }
1000
+ }
1001
+
988
1002
  _startPanelDrag(pEvent, pTarget)
989
1003
  {
990
1004
  let tmpPanelHash = this._getPanelHash(pTarget);
@@ -999,6 +1013,7 @@ class PictServiceFlowInteractionManager extends libFableServiceProviderBase
999
1013
  this._DragPanelStartY = pEvent.clientY;
1000
1014
  this._DragPanelDataStartX = tmpPanel.X;
1001
1015
  this._DragPanelDataStartY = tmpPanel.Y;
1016
+ this._setPanelGestureActive(tmpPanelHash, true);
1002
1017
  }
1003
1018
 
1004
1019
  _onPanelDrag(pEvent)
@@ -1026,6 +1041,7 @@ class PictServiceFlowInteractionManager extends libFableServiceProviderBase
1026
1041
  this._FlowView._EventHandlerProvider.fireEvent('onFlowChanged', this._FlowView.flowData);
1027
1042
  }
1028
1043
 
1044
+ this._setPanelGestureActive(this._DragPanelHash, false);
1029
1045
  this._setState(INTERACTION_STATES.IDLE);
1030
1046
  this._DragPanelHash = null;
1031
1047
  }
@@ -1044,6 +1060,7 @@ class PictServiceFlowInteractionManager extends libFableServiceProviderBase
1044
1060
  this._ResizePanelHash = tmpPanelHash;
1045
1061
  this._ResizeStartY = pEvent.clientY;
1046
1062
  this._ResizePanelStartHeight = tmpPanel.Height;
1063
+ this._setPanelGestureActive(tmpPanelHash, true);
1047
1064
  }
1048
1065
 
1049
1066
  _onPanelResize(pEvent)
@@ -1083,6 +1100,7 @@ class PictServiceFlowInteractionManager extends libFableServiceProviderBase
1083
1100
  this._FlowView._EventHandlerProvider.fireEvent('onFlowChanged', this._FlowView.flowData);
1084
1101
  }
1085
1102
 
1103
+ this._setPanelGestureActive(this._ResizePanelHash, false);
1086
1104
  this._setState(INTERACTION_STATES.IDLE);
1087
1105
  this._ResizePanelHash = null;
1088
1106
  }
@@ -70,9 +70,12 @@ class PictServiceFlowViewportManager extends libFableServiceProviderBase
70
70
  }
71
71
 
72
72
  /**
73
- * Zoom to fit all nodes in the viewport
73
+ * Zoom to fit all nodes in the viewport.
74
+ * @param {boolean} pAllowZoomIn - when true the fit may scale UP past 1.0 (to MaxZoom) so a small board
75
+ * fills the viewport. Default (falsy) keeps the historic behavior: never zoom in past 1.0, so content
76
+ * stays true-to-scale and a sparse map does not balloon. Presentation banners opt in.
74
77
  */
75
- zoomToFit()
78
+ zoomToFit(pAllowZoomIn)
76
79
  {
77
80
  if (this._FlowView._FlowData.Nodes.length === 0) return;
78
81
  if (!this._FlowView._SVGElement) return;
@@ -96,7 +99,8 @@ class PictServiceFlowViewportManager extends libFableServiceProviderBase
96
99
  let tmpSVGRect = this._FlowView._SVGElement.getBoundingClientRect();
97
100
  let tmpScaleX = tmpSVGRect.width / tmpFlowWidth;
98
101
  let tmpScaleY = tmpSVGRect.height / tmpFlowHeight;
99
- let tmpZoom = Math.min(tmpScaleX, tmpScaleY, 1.0); // Don't zoom in past 1.0
102
+ let tmpZoom = Math.min(tmpScaleX, tmpScaleY);
103
+ if (!pAllowZoomIn) { tmpZoom = Math.min(tmpZoom, 1.0); } // Don't zoom in past 1.0 unless the caller opts in
100
104
  tmpZoom = Math.max(this._FlowView.options.MinZoom, Math.min(this._FlowView.options.MaxZoom, tmpZoom));
101
105
 
102
106
  let tmpCenterX = (tmpMinX + tmpMaxX) / 2;
@@ -1297,11 +1297,12 @@ class PictViewFlow extends libPictView
1297
1297
  }
1298
1298
 
1299
1299
  /**
1300
- * Zoom to fit all nodes in the viewport
1300
+ * Zoom to fit all nodes in the viewport.
1301
+ * @param {boolean} pAllowZoomIn - when true the fit may scale up past 1.0 (presentation banners opt in).
1301
1302
  */
1302
- zoomToFit()
1303
+ zoomToFit(pAllowZoomIn)
1303
1304
  {
1304
- return this._ViewportManager.zoomToFit();
1305
+ return this._ViewportManager.zoomToFit(pAllowZoomIn);
1305
1306
  }
1306
1307
 
1307
1308
  /**