@wcardinal/wcardinal-ui 0.431.0 → 0.433.0

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.
Files changed (37) hide show
  1. package/dist/types/wcardinal/ui/d-diagram-canvas-editor-snap.d.ts +13 -2
  2. package/dist/types/wcardinal/ui/d-diagram-canvas-editor.d.ts +3 -1
  3. package/dist/wcardinal/ui/d-chart-selection-gridline-x.js +2 -1
  4. package/dist/wcardinal/ui/d-chart-selection-gridline-x.js.map +1 -1
  5. package/dist/wcardinal/ui/d-chart-selection-gridline-y.js +2 -1
  6. package/dist/wcardinal/ui/d-chart-selection-gridline-y.js.map +1 -1
  7. package/dist/wcardinal/ui/d-diagram-canvas-editor-snap.js +84 -24
  8. package/dist/wcardinal/ui/d-diagram-canvas-editor-snap.js.map +1 -1
  9. package/dist/wcardinal/ui/d-diagram-canvas-editor.js +22 -10
  10. package/dist/wcardinal/ui/d-diagram-canvas-editor.js.map +1 -1
  11. package/dist/wcardinal/ui/snapper/e-snapper-grid.js +1 -1
  12. package/dist/wcardinal/ui/snapper/e-snapper-grid.js.map +1 -1
  13. package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-canvas-editor.js +13 -1
  14. package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-canvas-editor.js.map +1 -1
  15. package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-canvas-editor.js +13 -1
  16. package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-canvas-editor.js.map +1 -1
  17. package/dist/wcardinal-ui-theme-dark-en-us.js +14 -2
  18. package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
  19. package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
  20. package/dist/wcardinal-ui-theme-dark-ja-jp.js +14 -2
  21. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
  22. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
  23. package/dist/wcardinal-ui-theme-dark.js +14 -2
  24. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  25. package/dist/wcardinal-ui-theme-white-en-us.js +14 -2
  26. package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
  27. package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
  28. package/dist/wcardinal-ui-theme-white-ja-jp.js +14 -2
  29. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
  30. package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
  31. package/dist/wcardinal-ui-theme-white.js +14 -2
  32. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  33. package/dist/wcardinal-ui.cjs.js +138 -40
  34. package/dist/wcardinal-ui.js +112 -38
  35. package/dist/wcardinal-ui.min.js +2 -2
  36. package/dist/wcardinal-ui.min.js.map +1 -1
  37. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.431.0
2
+ Winter Cardinal UI v0.433.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -47852,7 +47852,7 @@ var ESnapperGrid = /** @class */ (function (_super) {
47852
47852
  this.size = serialized[2];
47853
47853
  }
47854
47854
  else {
47855
- this.visible = false;
47855
+ this.visible = this._isVisibleDefault;
47856
47856
  this.size = serialized[1];
47857
47857
  }
47858
47858
  };
@@ -56317,9 +56317,21 @@ var loadThemeWhiteEnUsDiagram = function () {
56317
56317
  * Copyright (C) 2019 Toshiba Corporation
56318
56318
  * SPDX-License-Identifier: Apache-2.0
56319
56319
  */
56320
- var toGridSize$1 = function (grid, width, height) {
56320
+ var toGridScale$1 = function (scale) {
56321
+ if (scale <= 0 || 1 <= scale) {
56322
+ return 1;
56323
+ }
56324
+ var target = 1 / scale;
56325
+ var result = 1;
56326
+ while (result < target && result < Number.MAX_SAFE_INTEGER) {
56327
+ result <<= 1;
56328
+ }
56329
+ return result;
56330
+ };
56331
+ var toGridSize$1 = function (grid, width, height, scale) {
56321
56332
  var canvas = Math.max(width, height);
56322
56333
  if (0 < grid) {
56334
+ grid *= toGridScale$1(scale);
56323
56335
  var minimum = canvas / 1000;
56324
56336
  for (var i = 0; i < 10 && grid < minimum; ++i) {
56325
56337
  grid *= 10;
@@ -66850,9 +66862,21 @@ var loadThemeDarkEnUsDiagram = function () {
66850
66862
  * Copyright (C) 2019 Toshiba Corporation
66851
66863
  * SPDX-License-Identifier: Apache-2.0
66852
66864
  */
66853
- var toGridSize = function (grid, width, height) {
66865
+ var toGridScale = function (scale) {
66866
+ if (scale <= 0 || 1 <= scale) {
66867
+ return 1;
66868
+ }
66869
+ var target = 1 / scale;
66870
+ var result = 1;
66871
+ while (result < target && result < Number.MAX_SAFE_INTEGER) {
66872
+ result <<= 1;
66873
+ }
66874
+ return result;
66875
+ };
66876
+ var toGridSize = function (grid, width, height, scale) {
66854
66877
  var canvas = Math.max(width, height);
66855
66878
  if (0 < grid) {
66879
+ grid *= toGridScale(scale);
66856
66880
  var minimum = canvas / 1000;
66857
66881
  for (var i = 0; i < 10 && grid < minimum; ++i) {
66858
66882
  grid *= 10;
@@ -83814,7 +83838,8 @@ var DChartSelectionGridlineX = /** @class */ (function (_super) {
83814
83838
  var bounds = container.plotArea.getSelectionBoundsX();
83815
83839
  shape.transform.position.set(mappedX, bounds.y + bounds.height * 0.5);
83816
83840
  shape.size.set(0, bounds.height);
83817
- shape.visible = bounds.x <= mappedX && mappedX <= bounds.x + bounds.width;
83841
+ var hw = shape.stroke.width * 0.5;
83842
+ shape.visible = bounds.x <= mappedX + hw && mappedX - hw <= bounds.x + bounds.width;
83818
83843
  return true;
83819
83844
  }
83820
83845
  return false;
@@ -83841,7 +83866,8 @@ var DChartSelectionGridlineY = /** @class */ (function (_super) {
83841
83866
  var bounds = container.plotArea.getSelectionBoundsY();
83842
83867
  shape.transform.position.set(bounds.x + bounds.width * 0.5, mappedY);
83843
83868
  shape.size.set(bounds.width, 0);
83844
- shape.visible = bounds.y <= mappedY && mappedY <= bounds.y + bounds.height;
83869
+ var hw = shape.stroke.width * 0.5;
83870
+ shape.visible = bounds.y <= mappedY + hw && mappedY - hw <= bounds.y + bounds.height;
83845
83871
  return true;
83846
83872
  }
83847
83873
  return false;
@@ -87300,6 +87326,7 @@ var DDiagramCanvasEditorSnap = /** @class */ (function () {
87300
87326
  function DDiagramCanvasEditorSnap(parent, theme, options) {
87301
87327
  var _this = this;
87302
87328
  this._parent = parent;
87329
+ this._isDirty = true;
87303
87330
  // Controller
87304
87331
  var controller = options.controller;
87305
87332
  this._controller = controller;
@@ -87315,49 +87342,84 @@ var DDiagramCanvasEditorSnap = /** @class */ (function () {
87315
87342
  parent.addChildAt(container, parent.children.length - 1);
87316
87343
  // Grid
87317
87344
  this._grid = this.toGrid(theme, options.grid);
87345
+ this._gridParentWidth = parent.width;
87346
+ this._gridParentHeight = parent.height;
87347
+ this._gridParentScale = parent.scale.x;
87348
+ this._gridSize = this.newGridSize();
87318
87349
  // Target
87319
87350
  this._target = this.toTarget(theme, options.target);
87320
87351
  }
87321
87352
  DDiagramCanvasEditorSnap.prototype.toGrid = function (theme, options) {
87322
87353
  var _a;
87354
+ if (options != null) {
87355
+ return {
87356
+ major: this.toGridMajor(theme, options.major),
87357
+ minor: this.toGridMinor(theme, options.minor),
87358
+ size: (_a = options.size) !== null && _a !== void 0 ? _a : theme.getSnapGridSize()
87359
+ };
87360
+ }
87323
87361
  return {
87324
- major: this.toGridMajor(theme, options === null || options === void 0 ? void 0 : options.major),
87325
- minor: this.toGridMinor(theme, options === null || options === void 0 ? void 0 : options.minor),
87326
- size: (_a = options === null || options === void 0 ? void 0 : options.size) !== null && _a !== void 0 ? _a : theme.getSnapGridSize()
87362
+ major: this.toGridMajor(theme),
87363
+ minor: this.toGridMinor(theme),
87364
+ size: theme.getSnapGridSize()
87327
87365
  };
87328
87366
  };
87329
87367
  DDiagramCanvasEditorSnap.prototype.toGridMajor = function (theme, options) {
87330
87368
  var _a, _b, _c, _d, _e;
87369
+ if (options != null) {
87370
+ return {
87371
+ interval: (_a = options.interval) !== null && _a !== void 0 ? _a : theme.getSnapGridMajorInterval(),
87372
+ color: (_b = options.color) !== null && _b !== void 0 ? _b : theme.getSnapGridMajorColor(),
87373
+ alpha: (_c = options.alpha) !== null && _c !== void 0 ? _c : theme.getSnapGridMajorAlpha(),
87374
+ width: (_d = options.width) !== null && _d !== void 0 ? _d : theme.getSnapGridMajorWidth(),
87375
+ style: (_e = options.style) !== null && _e !== void 0 ? _e : theme.getSnapGridMajorStyle()
87376
+ };
87377
+ }
87331
87378
  return {
87332
- interval: (_a = options === null || options === void 0 ? void 0 : options.interval) !== null && _a !== void 0 ? _a : theme.getSnapGridMajorInterval(),
87333
- color: (_b = options === null || options === void 0 ? void 0 : options.color) !== null && _b !== void 0 ? _b : theme.getSnapGridMajorColor(),
87334
- alpha: (_c = options === null || options === void 0 ? void 0 : options.alpha) !== null && _c !== void 0 ? _c : theme.getSnapGridMajorAlpha(),
87335
- width: (_d = options === null || options === void 0 ? void 0 : options.width) !== null && _d !== void 0 ? _d : theme.getSnapGridMajorWidth(),
87336
- style: (_e = options === null || options === void 0 ? void 0 : options.style) !== null && _e !== void 0 ? _e : theme.getSnapGridMajorStyle()
87379
+ interval: theme.getSnapGridMajorInterval(),
87380
+ color: theme.getSnapGridMajorColor(),
87381
+ alpha: theme.getSnapGridMajorAlpha(),
87382
+ width: theme.getSnapGridMajorWidth(),
87383
+ style: theme.getSnapGridMajorStyle()
87337
87384
  };
87338
87385
  };
87339
87386
  DDiagramCanvasEditorSnap.prototype.toGridMinor = function (theme, options) {
87340
87387
  var _a, _b, _c, _d;
87388
+ if (options != null) {
87389
+ return {
87390
+ color: (_a = options.color) !== null && _a !== void 0 ? _a : theme.getSnapGridMinorColor(),
87391
+ alpha: (_b = options.alpha) !== null && _b !== void 0 ? _b : theme.getSnapGridMinorAlpha(),
87392
+ width: (_c = options.width) !== null && _c !== void 0 ? _c : theme.getSnapGridMinorWidth(),
87393
+ style: (_d = options.style) !== null && _d !== void 0 ? _d : theme.getSnapGridMinorStyle()
87394
+ };
87395
+ }
87341
87396
  return {
87342
- color: (_a = options === null || options === void 0 ? void 0 : options.color) !== null && _a !== void 0 ? _a : theme.getSnapGridMinorColor(),
87343
- alpha: (_b = options === null || options === void 0 ? void 0 : options.alpha) !== null && _b !== void 0 ? _b : theme.getSnapGridMinorAlpha(),
87344
- width: (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : theme.getSnapGridMinorWidth(),
87345
- style: (_d = options === null || options === void 0 ? void 0 : options.style) !== null && _d !== void 0 ? _d : theme.getSnapGridMinorStyle()
87397
+ color: theme.getSnapGridMinorColor(),
87398
+ alpha: theme.getSnapGridMinorAlpha(),
87399
+ width: theme.getSnapGridMinorWidth(),
87400
+ style: theme.getSnapGridMinorStyle()
87346
87401
  };
87347
87402
  };
87348
87403
  DDiagramCanvasEditorSnap.prototype.toTarget = function (theme, options) {
87349
87404
  var _a, _b, _c, _d;
87405
+ if (options != null) {
87406
+ return {
87407
+ color: (_a = options.color) !== null && _a !== void 0 ? _a : theme.getSnapTargetColor(),
87408
+ alpha: (_b = options.alpha) !== null && _b !== void 0 ? _b : theme.getSnapTargetAlpha(),
87409
+ width: (_c = options.width) !== null && _c !== void 0 ? _c : theme.getSnapTargetWidth(),
87410
+ style: (_d = options.style) !== null && _d !== void 0 ? _d : theme.getSnapTargetStyle()
87411
+ };
87412
+ }
87350
87413
  return {
87351
- color: (_a = options === null || options === void 0 ? void 0 : options.color) !== null && _a !== void 0 ? _a : theme.getSnapTargetColor(),
87352
- alpha: (_b = options === null || options === void 0 ? void 0 : options.alpha) !== null && _b !== void 0 ? _b : theme.getSnapTargetAlpha(),
87353
- width: (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : theme.getSnapTargetWidth(),
87354
- style: (_d = options === null || options === void 0 ? void 0 : options.style) !== null && _d !== void 0 ? _d : theme.getSnapTargetStyle()
87414
+ color: theme.getSnapTargetColor(),
87415
+ alpha: theme.getSnapTargetAlpha(),
87416
+ width: theme.getSnapTargetWidth(),
87417
+ style: theme.getSnapTargetStyle()
87355
87418
  };
87356
87419
  };
87357
87420
  DDiagramCanvasEditorSnap.prototype.onChange = function () {
87358
- var parent = this._parent;
87359
- parent.toDirty();
87360
- DApplications.update(parent);
87421
+ this._isDirty = true;
87422
+ DApplications.update(this._parent);
87361
87423
  };
87362
87424
  Object.defineProperty(DDiagramCanvasEditorSnap.prototype, "container", {
87363
87425
  get: function () {
@@ -87369,15 +87431,39 @@ var DDiagramCanvasEditorSnap = /** @class */ (function () {
87369
87431
  DDiagramCanvasEditorSnap.prototype.serialize = function () {
87370
87432
  return this._controller.serialize();
87371
87433
  };
87372
- DDiagramCanvasEditorSnap.prototype.onReflow = function () {
87373
- var parent = this._parent;
87434
+ DDiagramCanvasEditorSnap.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
87435
+ this._gridParentWidth = newWidth;
87436
+ this._gridParentHeight = newHeight;
87437
+ this.updateGridSize();
87438
+ };
87439
+ DDiagramCanvasEditorSnap.prototype.onScale = function (newX, newY, oldX, oldY) {
87440
+ this._gridParentScale = newX;
87441
+ this.updateGridSize();
87442
+ };
87443
+ DDiagramCanvasEditorSnap.prototype.updateGridSize = function () {
87444
+ var gridSize = this.newGridSize();
87445
+ if (this._gridSize !== gridSize) {
87446
+ this._gridSize = gridSize;
87447
+ this._isDirty = true;
87448
+ }
87449
+ };
87450
+ DDiagramCanvasEditorSnap.prototype.newGridSize = function () {
87451
+ return this._grid.size(this._controller.grid.size, this._gridParentWidth, this._gridParentHeight, this._gridParentScale);
87452
+ };
87453
+ DDiagramCanvasEditorSnap.prototype.onRender = function () {
87454
+ if (this._isDirty) {
87455
+ this._isDirty = false;
87456
+ this.updateAll();
87457
+ }
87458
+ };
87459
+ DDiagramCanvasEditorSnap.prototype.updateAll = function () {
87374
87460
  var container = this._container;
87375
87461
  var controller = this._controller;
87376
87462
  var isGridVisible = controller.grid.visible;
87377
87463
  var isTargetVisible = controller.target.visible;
87378
87464
  if (isGridVisible || isTargetVisible) {
87379
- var w = parent.width;
87380
- var h = parent.height;
87465
+ var w = this._gridParentWidth;
87466
+ var h = this._gridParentHeight;
87381
87467
  var wh = 0.5 * w;
87382
87468
  var hh = 0.5 * h;
87383
87469
  var TOP = EShapeBarPosition.TOP;
@@ -87390,7 +87476,7 @@ var DDiagramCanvasEditorSnap = /** @class */ (function () {
87390
87476
  var major = grid.major;
87391
87477
  var minor = grid.minor;
87392
87478
  var interval = major.interval;
87393
- var size = grid.size(controller.grid.size, w, h);
87479
+ var size = this._gridSize;
87394
87480
  for (var x = size, ix = 1; x < w; x += size, ix += 1, index += 1) {
87395
87481
  var style = ix % interval === 0 ? major : minor;
87396
87482
  this.update(container, shapes, index, x, hh, TOP, w, h, style);
@@ -87483,12 +87569,8 @@ var DDiagramCanvasEditor = /** @class */ (function (_super) {
87483
87569
  });
87484
87570
  Object.defineProperty(DDiagramCanvasEditor.prototype, "shape", {
87485
87571
  get: function () {
87486
- var result = this._shape;
87487
- if (result == null) {
87488
- result = this.newShape();
87489
- this._shape = result;
87490
- }
87491
- return result;
87572
+ var _a;
87573
+ return ((_a = this._shape) !== null && _a !== void 0 ? _a : (this._shape = this.newShape()));
87492
87574
  },
87493
87575
  enumerable: false,
87494
87576
  configurable: true
@@ -87527,10 +87609,26 @@ var DDiagramCanvasEditor = /** @class */ (function (_super) {
87527
87609
  thumbnail: thumbnail === null || thumbnail === void 0 ? void 0 : thumbnail.serialize()
87528
87610
  };
87529
87611
  };
87530
- DDiagramCanvasEditor.prototype.onReflow = function () {
87531
- var _a;
87532
- _super.prototype.onReflow.call(this);
87533
- (_a = this._snap) === null || _a === void 0 ? void 0 : _a.onReflow();
87612
+ DDiagramCanvasEditor.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
87613
+ var snap = this._snap;
87614
+ if (snap != null) {
87615
+ snap.onResize(newWidth, newHeight, oldWidth, oldHeight);
87616
+ }
87617
+ _super.prototype.onResize.call(this, newWidth, newHeight, oldWidth, oldHeight);
87618
+ };
87619
+ DDiagramCanvasEditor.prototype.onScale = function (newX, newY, oldX, oldY) {
87620
+ var snap = this._snap;
87621
+ if (snap != null) {
87622
+ snap.onScale(newX, newY, oldX, oldY);
87623
+ }
87624
+ _super.prototype.onScale.call(this, newX, newY, oldX, oldY);
87625
+ };
87626
+ DDiagramCanvasEditor.prototype.render = function (renderer) {
87627
+ var snap = this._snap;
87628
+ if (snap != null) {
87629
+ snap.onRender();
87630
+ }
87631
+ _super.prototype.render.call(this, renderer);
87534
87632
  };
87535
87633
  DDiagramCanvasEditor.prototype.getType = function () {
87536
87634
  return "DDiagramCanvasEditor";
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.431.0
2
+ Winter Cardinal UI v0.433.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -47849,7 +47849,7 @@
47849
47849
  this.size = serialized[2];
47850
47850
  }
47851
47851
  else {
47852
- this.visible = false;
47852
+ this.visible = this._isVisibleDefault;
47853
47853
  this.size = serialized[1];
47854
47854
  }
47855
47855
  };
@@ -62653,7 +62653,8 @@
62653
62653
  var bounds = container.plotArea.getSelectionBoundsX();
62654
62654
  shape.transform.position.set(mappedX, bounds.y + bounds.height * 0.5);
62655
62655
  shape.size.set(0, bounds.height);
62656
- shape.visible = bounds.x <= mappedX && mappedX <= bounds.x + bounds.width;
62656
+ var hw = shape.stroke.width * 0.5;
62657
+ shape.visible = bounds.x <= mappedX + hw && mappedX - hw <= bounds.x + bounds.width;
62657
62658
  return true;
62658
62659
  }
62659
62660
  return false;
@@ -62680,7 +62681,8 @@
62680
62681
  var bounds = container.plotArea.getSelectionBoundsY();
62681
62682
  shape.transform.position.set(bounds.x + bounds.width * 0.5, mappedY);
62682
62683
  shape.size.set(bounds.width, 0);
62683
- shape.visible = bounds.y <= mappedY && mappedY <= bounds.y + bounds.height;
62684
+ var hw = shape.stroke.width * 0.5;
62685
+ shape.visible = bounds.y <= mappedY + hw && mappedY - hw <= bounds.y + bounds.height;
62684
62686
  return true;
62685
62687
  }
62686
62688
  return false;
@@ -66139,6 +66141,7 @@
66139
66141
  function DDiagramCanvasEditorSnap(parent, theme, options) {
66140
66142
  var _this = this;
66141
66143
  this._parent = parent;
66144
+ this._isDirty = true;
66142
66145
  // Controller
66143
66146
  var controller = options.controller;
66144
66147
  this._controller = controller;
@@ -66154,49 +66157,84 @@
66154
66157
  parent.addChildAt(container, parent.children.length - 1);
66155
66158
  // Grid
66156
66159
  this._grid = this.toGrid(theme, options.grid);
66160
+ this._gridParentWidth = parent.width;
66161
+ this._gridParentHeight = parent.height;
66162
+ this._gridParentScale = parent.scale.x;
66163
+ this._gridSize = this.newGridSize();
66157
66164
  // Target
66158
66165
  this._target = this.toTarget(theme, options.target);
66159
66166
  }
66160
66167
  DDiagramCanvasEditorSnap.prototype.toGrid = function (theme, options) {
66161
66168
  var _a;
66169
+ if (options != null) {
66170
+ return {
66171
+ major: this.toGridMajor(theme, options.major),
66172
+ minor: this.toGridMinor(theme, options.minor),
66173
+ size: (_a = options.size) !== null && _a !== void 0 ? _a : theme.getSnapGridSize()
66174
+ };
66175
+ }
66162
66176
  return {
66163
- major: this.toGridMajor(theme, options === null || options === void 0 ? void 0 : options.major),
66164
- minor: this.toGridMinor(theme, options === null || options === void 0 ? void 0 : options.minor),
66165
- size: (_a = options === null || options === void 0 ? void 0 : options.size) !== null && _a !== void 0 ? _a : theme.getSnapGridSize()
66177
+ major: this.toGridMajor(theme),
66178
+ minor: this.toGridMinor(theme),
66179
+ size: theme.getSnapGridSize()
66166
66180
  };
66167
66181
  };
66168
66182
  DDiagramCanvasEditorSnap.prototype.toGridMajor = function (theme, options) {
66169
66183
  var _a, _b, _c, _d, _e;
66184
+ if (options != null) {
66185
+ return {
66186
+ interval: (_a = options.interval) !== null && _a !== void 0 ? _a : theme.getSnapGridMajorInterval(),
66187
+ color: (_b = options.color) !== null && _b !== void 0 ? _b : theme.getSnapGridMajorColor(),
66188
+ alpha: (_c = options.alpha) !== null && _c !== void 0 ? _c : theme.getSnapGridMajorAlpha(),
66189
+ width: (_d = options.width) !== null && _d !== void 0 ? _d : theme.getSnapGridMajorWidth(),
66190
+ style: (_e = options.style) !== null && _e !== void 0 ? _e : theme.getSnapGridMajorStyle()
66191
+ };
66192
+ }
66170
66193
  return {
66171
- interval: (_a = options === null || options === void 0 ? void 0 : options.interval) !== null && _a !== void 0 ? _a : theme.getSnapGridMajorInterval(),
66172
- color: (_b = options === null || options === void 0 ? void 0 : options.color) !== null && _b !== void 0 ? _b : theme.getSnapGridMajorColor(),
66173
- alpha: (_c = options === null || options === void 0 ? void 0 : options.alpha) !== null && _c !== void 0 ? _c : theme.getSnapGridMajorAlpha(),
66174
- width: (_d = options === null || options === void 0 ? void 0 : options.width) !== null && _d !== void 0 ? _d : theme.getSnapGridMajorWidth(),
66175
- style: (_e = options === null || options === void 0 ? void 0 : options.style) !== null && _e !== void 0 ? _e : theme.getSnapGridMajorStyle()
66194
+ interval: theme.getSnapGridMajorInterval(),
66195
+ color: theme.getSnapGridMajorColor(),
66196
+ alpha: theme.getSnapGridMajorAlpha(),
66197
+ width: theme.getSnapGridMajorWidth(),
66198
+ style: theme.getSnapGridMajorStyle()
66176
66199
  };
66177
66200
  };
66178
66201
  DDiagramCanvasEditorSnap.prototype.toGridMinor = function (theme, options) {
66179
66202
  var _a, _b, _c, _d;
66203
+ if (options != null) {
66204
+ return {
66205
+ color: (_a = options.color) !== null && _a !== void 0 ? _a : theme.getSnapGridMinorColor(),
66206
+ alpha: (_b = options.alpha) !== null && _b !== void 0 ? _b : theme.getSnapGridMinorAlpha(),
66207
+ width: (_c = options.width) !== null && _c !== void 0 ? _c : theme.getSnapGridMinorWidth(),
66208
+ style: (_d = options.style) !== null && _d !== void 0 ? _d : theme.getSnapGridMinorStyle()
66209
+ };
66210
+ }
66180
66211
  return {
66181
- color: (_a = options === null || options === void 0 ? void 0 : options.color) !== null && _a !== void 0 ? _a : theme.getSnapGridMinorColor(),
66182
- alpha: (_b = options === null || options === void 0 ? void 0 : options.alpha) !== null && _b !== void 0 ? _b : theme.getSnapGridMinorAlpha(),
66183
- width: (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : theme.getSnapGridMinorWidth(),
66184
- style: (_d = options === null || options === void 0 ? void 0 : options.style) !== null && _d !== void 0 ? _d : theme.getSnapGridMinorStyle()
66212
+ color: theme.getSnapGridMinorColor(),
66213
+ alpha: theme.getSnapGridMinorAlpha(),
66214
+ width: theme.getSnapGridMinorWidth(),
66215
+ style: theme.getSnapGridMinorStyle()
66185
66216
  };
66186
66217
  };
66187
66218
  DDiagramCanvasEditorSnap.prototype.toTarget = function (theme, options) {
66188
66219
  var _a, _b, _c, _d;
66220
+ if (options != null) {
66221
+ return {
66222
+ color: (_a = options.color) !== null && _a !== void 0 ? _a : theme.getSnapTargetColor(),
66223
+ alpha: (_b = options.alpha) !== null && _b !== void 0 ? _b : theme.getSnapTargetAlpha(),
66224
+ width: (_c = options.width) !== null && _c !== void 0 ? _c : theme.getSnapTargetWidth(),
66225
+ style: (_d = options.style) !== null && _d !== void 0 ? _d : theme.getSnapTargetStyle()
66226
+ };
66227
+ }
66189
66228
  return {
66190
- color: (_a = options === null || options === void 0 ? void 0 : options.color) !== null && _a !== void 0 ? _a : theme.getSnapTargetColor(),
66191
- alpha: (_b = options === null || options === void 0 ? void 0 : options.alpha) !== null && _b !== void 0 ? _b : theme.getSnapTargetAlpha(),
66192
- width: (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : theme.getSnapTargetWidth(),
66193
- style: (_d = options === null || options === void 0 ? void 0 : options.style) !== null && _d !== void 0 ? _d : theme.getSnapTargetStyle()
66229
+ color: theme.getSnapTargetColor(),
66230
+ alpha: theme.getSnapTargetAlpha(),
66231
+ width: theme.getSnapTargetWidth(),
66232
+ style: theme.getSnapTargetStyle()
66194
66233
  };
66195
66234
  };
66196
66235
  DDiagramCanvasEditorSnap.prototype.onChange = function () {
66197
- var parent = this._parent;
66198
- parent.toDirty();
66199
- DApplications.update(parent);
66236
+ this._isDirty = true;
66237
+ DApplications.update(this._parent);
66200
66238
  };
66201
66239
  Object.defineProperty(DDiagramCanvasEditorSnap.prototype, "container", {
66202
66240
  get: function () {
@@ -66208,15 +66246,39 @@
66208
66246
  DDiagramCanvasEditorSnap.prototype.serialize = function () {
66209
66247
  return this._controller.serialize();
66210
66248
  };
66211
- DDiagramCanvasEditorSnap.prototype.onReflow = function () {
66212
- var parent = this._parent;
66249
+ DDiagramCanvasEditorSnap.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
66250
+ this._gridParentWidth = newWidth;
66251
+ this._gridParentHeight = newHeight;
66252
+ this.updateGridSize();
66253
+ };
66254
+ DDiagramCanvasEditorSnap.prototype.onScale = function (newX, newY, oldX, oldY) {
66255
+ this._gridParentScale = newX;
66256
+ this.updateGridSize();
66257
+ };
66258
+ DDiagramCanvasEditorSnap.prototype.updateGridSize = function () {
66259
+ var gridSize = this.newGridSize();
66260
+ if (this._gridSize !== gridSize) {
66261
+ this._gridSize = gridSize;
66262
+ this._isDirty = true;
66263
+ }
66264
+ };
66265
+ DDiagramCanvasEditorSnap.prototype.newGridSize = function () {
66266
+ return this._grid.size(this._controller.grid.size, this._gridParentWidth, this._gridParentHeight, this._gridParentScale);
66267
+ };
66268
+ DDiagramCanvasEditorSnap.prototype.onRender = function () {
66269
+ if (this._isDirty) {
66270
+ this._isDirty = false;
66271
+ this.updateAll();
66272
+ }
66273
+ };
66274
+ DDiagramCanvasEditorSnap.prototype.updateAll = function () {
66213
66275
  var container = this._container;
66214
66276
  var controller = this._controller;
66215
66277
  var isGridVisible = controller.grid.visible;
66216
66278
  var isTargetVisible = controller.target.visible;
66217
66279
  if (isGridVisible || isTargetVisible) {
66218
- var w = parent.width;
66219
- var h = parent.height;
66280
+ var w = this._gridParentWidth;
66281
+ var h = this._gridParentHeight;
66220
66282
  var wh = 0.5 * w;
66221
66283
  var hh = 0.5 * h;
66222
66284
  var TOP = EShapeBarPosition.TOP;
@@ -66229,7 +66291,7 @@
66229
66291
  var major = grid.major;
66230
66292
  var minor = grid.minor;
66231
66293
  var interval = major.interval;
66232
- var size = grid.size(controller.grid.size, w, h);
66294
+ var size = this._gridSize;
66233
66295
  for (var x = size, ix = 1; x < w; x += size, ix += 1, index += 1) {
66234
66296
  var style = ix % interval === 0 ? major : minor;
66235
66297
  this.update(container, shapes, index, x, hh, TOP, w, h, style);
@@ -66322,12 +66384,8 @@
66322
66384
  });
66323
66385
  Object.defineProperty(DDiagramCanvasEditor.prototype, "shape", {
66324
66386
  get: function () {
66325
- var result = this._shape;
66326
- if (result == null) {
66327
- result = this.newShape();
66328
- this._shape = result;
66329
- }
66330
- return result;
66387
+ var _a;
66388
+ return ((_a = this._shape) !== null && _a !== void 0 ? _a : (this._shape = this.newShape()));
66331
66389
  },
66332
66390
  enumerable: false,
66333
66391
  configurable: true
@@ -66366,10 +66424,26 @@
66366
66424
  thumbnail: thumbnail === null || thumbnail === void 0 ? void 0 : thumbnail.serialize()
66367
66425
  };
66368
66426
  };
66369
- DDiagramCanvasEditor.prototype.onReflow = function () {
66370
- var _a;
66371
- _super.prototype.onReflow.call(this);
66372
- (_a = this._snap) === null || _a === void 0 ? void 0 : _a.onReflow();
66427
+ DDiagramCanvasEditor.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
66428
+ var snap = this._snap;
66429
+ if (snap != null) {
66430
+ snap.onResize(newWidth, newHeight, oldWidth, oldHeight);
66431
+ }
66432
+ _super.prototype.onResize.call(this, newWidth, newHeight, oldWidth, oldHeight);
66433
+ };
66434
+ DDiagramCanvasEditor.prototype.onScale = function (newX, newY, oldX, oldY) {
66435
+ var snap = this._snap;
66436
+ if (snap != null) {
66437
+ snap.onScale(newX, newY, oldX, oldY);
66438
+ }
66439
+ _super.prototype.onScale.call(this, newX, newY, oldX, oldY);
66440
+ };
66441
+ DDiagramCanvasEditor.prototype.render = function (renderer) {
66442
+ var snap = this._snap;
66443
+ if (snap != null) {
66444
+ snap.onRender();
66445
+ }
66446
+ _super.prototype.render.call(this, renderer);
66373
66447
  };
66374
66448
  DDiagramCanvasEditor.prototype.getType = function () {
66375
66449
  return "DDiagramCanvasEditor";