@finos/legend-extension-dsl-diagram 7.1.47 → 7.1.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. package/lib/DiagramRenderer.d.ts +6 -1
  2. package/lib/DiagramRenderer.d.ts.map +1 -1
  3. package/lib/DiagramRenderer.js +44 -27
  4. package/lib/DiagramRenderer.js.map +1 -1
  5. package/lib/application/studio/DSL_Diagram_LegendStudioTesting.d.ts +2 -1
  6. package/lib/application/studio/DSL_Diagram_LegendStudioTesting.d.ts.map +1 -1
  7. package/lib/application/studio/DSL_Diagram_LegendStudioTesting.js +1 -0
  8. package/lib/application/studio/DSL_Diagram_LegendStudioTesting.js.map +1 -1
  9. package/lib/components/studio/DiagramEditor.d.ts.map +1 -1
  10. package/lib/components/studio/DiagramEditor.js +2 -1
  11. package/lib/components/studio/DiagramEditor.js.map +1 -1
  12. package/lib/graph/helpers/DSL_Diagram_Helper.d.ts.map +1 -1
  13. package/lib/graph/helpers/DSL_Diagram_Helper.js +5 -3
  14. package/lib/graph/helpers/DSL_Diagram_Helper.js.map +1 -1
  15. package/lib/graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipView.d.ts.map +1 -1
  16. package/lib/graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipView.js +5 -5
  17. package/lib/graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipView.js.map +1 -1
  18. package/lib/graphManager/protocol/pure/DSL_Diagram_PureProtocolProcessorPlugin.js +1 -1
  19. package/lib/graphManager/protocol/pure/DSL_Diagram_PureProtocolProcessorPlugin.js.map +1 -1
  20. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/V1_DSL_Diagram_GraphBuilderHelper.d.ts +1 -1
  21. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/V1_DSL_Diagram_GraphBuilderHelper.d.ts.map +1 -1
  22. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/V1_DSL_Diagram_GraphBuilderHelper.js +20 -4
  23. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/V1_DSL_Diagram_GraphBuilderHelper.js.map +1 -1
  24. package/lib/index.css +1 -1
  25. package/lib/package.json +2 -2
  26. package/package.json +9 -9
  27. package/src/DiagramRenderer.ts +100 -36
  28. package/src/application/studio/DSL_Diagram_LegendStudioTesting.ts +1 -0
  29. package/src/components/studio/DiagramEditor.tsx +2 -0
  30. package/src/graph/helpers/DSL_Diagram_Helper.ts +11 -3
  31. package/src/graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipView.ts +5 -5
  32. package/src/graphManager/protocol/pure/DSL_Diagram_PureProtocolProcessorPlugin.ts +1 -1
  33. package/src/graphManager/protocol/pure/v1/transformation/pureGraph/V1_DSL_Diagram_GraphBuilderHelper.ts +19 -2
@@ -196,6 +196,11 @@ export declare class DiagramRenderer {
196
196
  truncateTextWithEllipsis(val: string, limit?: number): string;
197
197
  canvasCoordinateToModelCoordinate(point: Point): Point;
198
198
  modelCoordinateToCanvasCoordinate(point: Point): Point;
199
+ /**
200
+ * Mouse events' coordinate x,y are relative to the viewport, not the canvas element
201
+ * so we need to calculate them relative to the canvas element
202
+ */
203
+ resolveMouseEventCoordinate(e: MouseEvent): Point;
199
204
  eventCoordinateToCanvasCoordinate(point: Point): Point;
200
205
  canvasCoordinateToEventCoordinate(point: Point): Point;
201
206
  hasPropertyView(classView: ClassView, property: AbstractProperty): boolean;
@@ -208,7 +213,7 @@ export declare class DiagramRenderer {
208
213
  * to change in zoom level to ensure the model coordinate stays constant.
209
214
  */
210
215
  private executeZoom;
211
- zoomPoint(zoomLevel: number, zoomPoint: Point): void;
216
+ private zoomPoint;
212
217
  zoomCenter(zoomLevel: number): void;
213
218
  zoomToFit(): void;
214
219
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DiagramRenderer.d.ts","sourceRoot":"","sources":["../src/DiagramRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,EAeN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C,aAAa;IAiLrB,OAAO,CAAC,mCAAmC;IAkD3C,OAAO,CAAC,oBAAoB;IAiH5B,OAAO,CAAC,yBAAyB;IAoLjC,OAAO,CAAC,eAAe;IAiJvB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAwBrC,QAAQ,IAAI,IAAI;IAchB,gBAAgB,IAAI,IAAI;IASxB,gBAAgB,IAAI,IAAI;IAOxB,eAAe,IAAI,IAAI;IAOvB,uBAAuB,IAAI,IAAI;IAS/B,0BAA0B,IAAI,IAAI;IASlC,oBAAoB,IAAI,IAAI;IAS5B,aAAa,IAAI,IAAI;IA8BrB,kBAAkB,CAChB,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GACtB,SAAS,EAAE,EAAE;IAoChB,cAAc,CACZ,eAAe,EAAE,SAAS,EAAE,EAAE,EAC9B,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,OAAO,EAC7B,SAAS,EAAE,OAAO,GACjB,CAAC,SAAS,EAAE,EAAE,kBAAkB,EAAE,CAAC;IAsGtC,OAAO,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;IAgM/B,OAAO,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAsK5B,aAAa,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAyElC,SAAS,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAuO9B,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAqB/B,SAAS,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;CAqW/B"}
@@ -611,6 +611,19 @@ export class DiagramRenderer {
611
611
  this.canvasCenter.x, (point.y - this.canvasCenter.y + this.screenOffset.y) * this.zoom +
612
612
  this.canvasCenter.y);
613
613
  }
614
+ /**
615
+ * Mouse events' coordinate x,y are relative to the viewport, not the canvas element
616
+ * so we need to calculate them relative to the canvas element
617
+ */
618
+ resolveMouseEventCoordinate(e) {
619
+ if (e.target instanceof HTMLElement) {
620
+ const targetEl = getElementPosition(e.target);
621
+ return new Point(targetEl.x + e.offsetX, targetEl.y + e.offsetY);
622
+ }
623
+ // NOTE: this is a fallback, should not happen
624
+ // since all mouse events shoud target the canvas element
625
+ return new Point(e.x, e.y);
626
+ }
614
627
  eventCoordinateToCanvasCoordinate(point) {
615
628
  return new Point(point.x - this.divPosition.x + this.div.scrollLeft, point.y - this.divPosition.y + this.div.scrollTop);
616
629
  }
@@ -645,7 +658,7 @@ export class DiagramRenderer {
645
658
  const box = this.drawLinePropertyText(
646
659
  // NOTE: by the way we compute the full path, it would guarantee
647
660
  // to always have at least 2 points
648
- fullPath[fullPath.length - 2], fullPath[fullPath.length - 1], relationshipView.to.classView.value, relationshipView.property.value, false);
661
+ guaranteeNonNullable(fullPath[fullPath.length - 2], 'Diagram path expected to have at least 2 points'), guaranteeNonNullable(fullPath[fullPath.length - 1], 'Diagram path expected to have at least 2 points'), relationshipView.to.classView.value, relationshipView.property.value, false);
649
662
  minX = Math.min(minX, box.position.x);
650
663
  minY = Math.min(minY, box.position.y);
651
664
  maxX = Math.max(maxX, getBottomRightCornerPoint(box).x);
@@ -682,14 +695,11 @@ export class DiagramRenderer {
682
695
  executeZoom(newZoomLevel, point) {
683
696
  // NOTE: we cap the minimum zoom level to avoid negative zoom
684
697
  newZoomLevel = Math.max(newZoomLevel, MIN_ZOOM_LEVEL);
685
- const canvasZoomCenterPosition = this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(point));
686
698
  const currentZoomLevel = this.zoom;
687
699
  this.setZoomLevel(newZoomLevel);
688
- this.screenOffset = new Point(((canvasZoomCenterPosition.x - this.canvasCenter.x) *
689
- (currentZoomLevel - newZoomLevel) +
700
+ this.screenOffset = new Point(((point.x - this.canvasCenter.x) * (currentZoomLevel - newZoomLevel) +
690
701
  this.screenOffset.x * currentZoomLevel) /
691
- newZoomLevel, ((canvasZoomCenterPosition.y - this.canvasCenter.y) *
692
- (currentZoomLevel - newZoomLevel) +
702
+ newZoomLevel, ((point.y - this.canvasCenter.y) * (currentZoomLevel - newZoomLevel) +
693
703
  this.screenOffset.y * currentZoomLevel) /
694
704
  newZoomLevel);
695
705
  this.clearScreen();
@@ -1298,7 +1308,7 @@ export class DiagramRenderer {
1298
1308
  this.drawLinePropertyText(
1299
1309
  // NOTE: by the way we compute the full path, it would guarantee
1300
1310
  // to always have at least 2 points
1301
- fullPath[fullPath.length - 2], fullPath[fullPath.length - 1], propertyView.to.classView.value, toProperty, false);
1311
+ guaranteeNonNullable(fullPath[fullPath.length - 2], 'Diagram path expected to have at least 2 points'), guaranteeNonNullable(fullPath[fullPath.length - 1], 'Diagram path expected to have at least 2 points'), propertyView.to.classView.value, toProperty, false);
1302
1312
  // if (asso.association) {
1303
1313
  // this.displayText(fullPath[1], fullPath[0], asso.from.classView, asso.association.properties[0], this.ctx);
1304
1314
  // }
@@ -1434,10 +1444,10 @@ export class DiagramRenderer {
1434
1444
  const fullPath = RelationshipView.pruneUnnecessaryInsidePoints(inheritance.buildFullPath(), inheritance.from.classView.value, inheritance.to.classView.value);
1435
1445
  // NOTE: by the way we compute the full path, it would guarantee
1436
1446
  // to always have at least 2 points
1437
- const startX = fullPath[fullPath.length - 2].x;
1438
- const startY = fullPath[fullPath.length - 2].y;
1439
- const endX = fullPath[fullPath.length - 1].x;
1440
- const endY = fullPath[fullPath.length - 1].y;
1447
+ const startX = guaranteeNonNullable(fullPath[fullPath.length - 2], 'Diagram path expected to have at least 2 points').x;
1448
+ const startY = guaranteeNonNullable(fullPath[fullPath.length - 2], 'Diagram path expected to have at least 2 points').y;
1449
+ const endX = guaranteeNonNullable(fullPath[fullPath.length - 1], 'Diagram path expected to have at least 2 points').x;
1450
+ const endY = guaranteeNonNullable(fullPath[fullPath.length - 1], 'Diagram path expected to have at least 2 points').y;
1441
1451
  let resultX = 0;
1442
1452
  let resultY = 0;
1443
1453
  if (endY > startY) {
@@ -1800,6 +1810,7 @@ export class DiagramRenderer {
1800
1810
  }
1801
1811
  }
1802
1812
  mouseup(e) {
1813
+ const mouseEventCoordinate = this.resolveMouseEventCoordinate(e);
1803
1814
  if (!this.isReadOnly) {
1804
1815
  switch (this.interactionMode) {
1805
1816
  case DIAGRAM_INTERACTION_MODE.LAYOUT: {
@@ -1809,7 +1820,7 @@ export class DiagramRenderer {
1809
1820
  break;
1810
1821
  }
1811
1822
  case DIAGRAM_INTERACTION_MODE.ADD_CLASS: {
1812
- const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(new Point(e.x, e.y)));
1823
+ const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate));
1813
1824
  this.onAddClassViewClick(eventPointInModelCoordinate);
1814
1825
  this.changeMode(DIAGRAM_INTERACTION_MODE.LAYOUT, DIAGRAM_RELATIONSHIP_EDIT_MODE.NONE);
1815
1826
  break;
@@ -1832,7 +1843,7 @@ export class DiagramRenderer {
1832
1843
  else {
1833
1844
  nextZoomLevel = guaranteeNonNullable(DIAGRAM_ZOOM_LEVELS.find((zoomLevel) => zoomLevel > currentZoomLevel));
1834
1845
  }
1835
- this.zoomPoint(nextZoomLevel / 100, new Point(e.x, e.y));
1846
+ this.zoomPoint(nextZoomLevel / 100, this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate)));
1836
1847
  break;
1837
1848
  }
1838
1849
  case DIAGRAM_INTERACTION_MODE.ZOOM_OUT: {
@@ -1849,14 +1860,14 @@ export class DiagramRenderer {
1849
1860
  else {
1850
1861
  nextZoomLevel = guaranteeNonNullable(findLast(DIAGRAM_ZOOM_LEVELS, (zoomLevel) => zoomLevel < currentZoomLevel));
1851
1862
  }
1852
- this.zoomPoint(nextZoomLevel / 100, new Point(e.x, e.y));
1863
+ this.zoomPoint(nextZoomLevel / 100, this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate)));
1853
1864
  break;
1854
1865
  }
1855
1866
  case DIAGRAM_INTERACTION_MODE.ADD_RELATIONSHIP: {
1856
1867
  if (this.startClassView &&
1857
1868
  this.selectionStart &&
1858
1869
  this.handleAddRelationship) {
1859
- const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(new Point(e.x, e.y)));
1870
+ const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate));
1860
1871
  for (let i = this.diagram.classViews.length - 1; i >= 0; i--) {
1861
1872
  const targetClassView = this.diagram.classViews[i];
1862
1873
  if (targetClassView.contains(eventPointInModelCoordinate.x, eventPointInModelCoordinate.y)) {
@@ -1893,6 +1904,7 @@ export class DiagramRenderer {
1893
1904
  this.drawScreen();
1894
1905
  }
1895
1906
  mousedblclick(e) {
1907
+ const mouseEventCoordinate = this.resolveMouseEventCoordinate(e);
1896
1908
  if ([
1897
1909
  DIAGRAM_INTERACTION_MODE.ADD_RELATIONSHIP,
1898
1910
  DIAGRAM_INTERACTION_MODE.ADD_CLASS,
@@ -1901,7 +1913,7 @@ export class DiagramRenderer {
1901
1913
  ].includes(this.interactionMode)) {
1902
1914
  return;
1903
1915
  }
1904
- const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(new Point(e.x, e.y)));
1916
+ const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate));
1905
1917
  // Check double click on class property
1906
1918
  if (this.mouseOverClassProperty) {
1907
1919
  if (this.onClassPropertyDoubleClick) {
@@ -1937,6 +1949,7 @@ export class DiagramRenderer {
1937
1949
  }
1938
1950
  }
1939
1951
  mousedown(e) {
1952
+ const mouseEventCoordinate = this.resolveMouseEventCoordinate(e);
1940
1953
  this.setSelectionStart(undefined);
1941
1954
  this.setSelectedClassCorner(undefined);
1942
1955
  this.setSelectedPropertyOrAssociation(undefined);
@@ -1945,14 +1958,14 @@ export class DiagramRenderer {
1945
1958
  this.selectedClassProperty = undefined;
1946
1959
  this.selectedPoint = undefined;
1947
1960
  this.startClassView = undefined;
1948
- const eventPointInCanvasCoordinate = this.eventCoordinateToCanvasCoordinate(new Point(e.x, e.y));
1961
+ const eventPointInCanvasCoordinate = this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate);
1949
1962
  const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(eventPointInCanvasCoordinate);
1950
1963
  // left click
1951
1964
  if (e.button === 0) {
1952
1965
  this.setLeftClick(true);
1953
1966
  switch (this.interactionMode) {
1954
1967
  case DIAGRAM_INTERACTION_MODE.PAN: {
1955
- this.positionBeforeLastMove = new Point(e.x, e.y);
1968
+ this.positionBeforeLastMove = mouseEventCoordinate;
1956
1969
  return;
1957
1970
  }
1958
1971
  case DIAGRAM_INTERACTION_MODE.LAYOUT: {
@@ -2082,13 +2095,13 @@ export class DiagramRenderer {
2082
2095
  // middle click
2083
2096
  else if (e.button === 1) {
2084
2097
  this.setMiddleClick(true);
2085
- this.positionBeforeLastMove = new Point(e.x, e.y);
2098
+ this.positionBeforeLastMove = mouseEventCoordinate;
2086
2099
  return;
2087
2100
  }
2088
2101
  // right click
2089
2102
  else if (e.button === 2) {
2090
2103
  this.setRightClick(true);
2091
- this.positionBeforeLastMove = new Point(e.x, e.y);
2104
+ this.positionBeforeLastMove = mouseEventCoordinate;
2092
2105
  if (this.mouseOverClassView) {
2093
2106
  this.onClassViewRightClick(this.mouseOverClassView, eventPointInModelCoordinate);
2094
2107
  this.setRightClick(false);
@@ -2099,6 +2112,7 @@ export class DiagramRenderer {
2099
2112
  this.drawAll();
2100
2113
  }
2101
2114
  mousewheel(e) {
2115
+ const mouseEventCoordinate = this.resolveMouseEventCoordinate(e);
2102
2116
  // no scrolling to be done since we want to convert scroll into zoom
2103
2117
  e.preventDefault();
2104
2118
  e.stopImmediatePropagation();
@@ -2109,21 +2123,24 @@ export class DiagramRenderer {
2109
2123
  }
2110
2124
  // scroll down to zoom in and up to zoom out
2111
2125
  const newZoomLevel = this.zoom - (e.deltaY / 120) * 0.05;
2112
- this.executeZoom(newZoomLevel, new Point(e.x, e.y));
2126
+ this.executeZoom(newZoomLevel, this.canvasCoordinateToModelCoordinate(this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate)));
2113
2127
  }
2114
2128
  mousemove(e) {
2115
- this.cursorPosition = new Point(e.x, e.y);
2129
+ const mouseEventCoordinate = this.resolveMouseEventCoordinate(e);
2130
+ this.cursorPosition = mouseEventCoordinate;
2116
2131
  // Pan/Move
2117
2132
  if (this.rightClick ||
2118
2133
  this.middleClick ||
2119
2134
  (this.leftClick && this.interactionMode === DIAGRAM_INTERACTION_MODE.PAN)) {
2120
- this.screenOffset = new Point(this.screenOffset.x + (e.x - this.positionBeforeLastMove.x) / this.zoom, this.screenOffset.y + (e.y - this.positionBeforeLastMove.y) / this.zoom);
2121
- this.positionBeforeLastMove = new Point(e.x, e.y);
2135
+ this.screenOffset = new Point(this.screenOffset.x +
2136
+ (mouseEventCoordinate.x - this.positionBeforeLastMove.x) / this.zoom, this.screenOffset.y +
2137
+ (mouseEventCoordinate.y - this.positionBeforeLastMove.y) / this.zoom);
2138
+ this.positionBeforeLastMove = mouseEventCoordinate;
2122
2139
  this.clearScreen();
2123
2140
  this.drawAll();
2124
2141
  }
2125
2142
  else if (this.leftClick) {
2126
- const eventPointInCanvasCoordinate = this.eventCoordinateToCanvasCoordinate(new Point(e.x, e.y));
2143
+ const eventPointInCanvasCoordinate = this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate);
2127
2144
  const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(eventPointInCanvasCoordinate);
2128
2145
  switch (this.interactionMode) {
2129
2146
  case DIAGRAM_INTERACTION_MODE.LAYOUT: {
@@ -2231,7 +2248,7 @@ export class DiagramRenderer {
2231
2248
  }
2232
2249
  else {
2233
2250
  this.drawScreen();
2234
- const eventPointInCanvasCoordinate = this.eventCoordinateToCanvasCoordinate(new Point(e.x, e.y));
2251
+ const eventPointInCanvasCoordinate = this.eventCoordinateToCanvasCoordinate(mouseEventCoordinate);
2235
2252
  const eventPointInModelCoordinate = this.canvasCoordinateToModelCoordinate(eventPointInCanvasCoordinate);
2236
2253
  // Check for hovering state
2237
2254
  this.setMouseOverClassView(undefined);
@@ -2296,7 +2313,7 @@ export class DiagramRenderer {
2296
2313
  const propertyInfoBox = this.drawLinePropertyText(
2297
2314
  // NOTE: by the way we compute the full path, it would guarantee
2298
2315
  // to always have at least 2 points
2299
- fullPath[fullPath.length - 2], fullPath[fullPath.length - 1], propertyHolderView.to.classView.value, propertyHolderView.property.value, false);
2316
+ guaranteeNonNullable(fullPath[fullPath.length - 2], 'Diagram path expected to have at least 2 points'), guaranteeNonNullable(fullPath[fullPath.length - 1], 'Diagram path expected to have at least 2 points'), propertyHolderView.to.classView.value, propertyHolderView.property.value, false);
2300
2317
  if (propertyInfoBox.contains(eventPointInModelCoordinate.x, eventPointInModelCoordinate.y)) {
2301
2318
  this.setMouseOverPropertyHolderViewLabel(propertyHolderView);
2302
2319
  break;