@plait/core 0.0.55 → 0.0.57

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 (54) hide show
  1. package/board/board.component.d.ts +19 -41
  2. package/board/board.component.interface.d.ts +5 -0
  3. package/core/element/before-context-change.d.ts +6 -0
  4. package/core/element/context.d.ts +7 -0
  5. package/core/element/element.component.d.ts +11 -3
  6. package/core/element/plugin-element.d.ts +22 -0
  7. package/core/toolbar/toolbar.component.d.ts +7 -8
  8. package/esm2020/board/board.component.interface.mjs +2 -0
  9. package/esm2020/board/board.component.mjs +217 -230
  10. package/esm2020/core/element/before-context-change.mjs +7 -0
  11. package/esm2020/core/element/context.mjs +2 -0
  12. package/esm2020/core/element/element.component.mjs +48 -12
  13. package/esm2020/core/element/plugin-element.mjs +60 -0
  14. package/esm2020/core/toolbar/toolbar.component.mjs +14 -22
  15. package/esm2020/interfaces/board.mjs +1 -1
  16. package/esm2020/interfaces/element.mjs +1 -1
  17. package/esm2020/interfaces/index.mjs +3 -3
  18. package/esm2020/interfaces/node.mjs +1 -1
  19. package/esm2020/interfaces/operation.mjs +15 -6
  20. package/esm2020/interfaces/path.mjs +2 -2
  21. package/esm2020/interfaces/pointer.mjs +6 -0
  22. package/esm2020/interfaces/viewport.mjs +2 -2
  23. package/esm2020/plugins/create-board.mjs +6 -7
  24. package/esm2020/plugins/with-hand.mjs +68 -0
  25. package/esm2020/plugins/with-selection.mjs +4 -2
  26. package/esm2020/public-api.mjs +3 -1
  27. package/esm2020/transforms/board.mjs +7 -0
  28. package/esm2020/transforms/general.mjs +1 -1
  29. package/esm2020/utils/board.mjs +1 -9
  30. package/esm2020/utils/matrix.mjs +131 -78
  31. package/esm2020/utils/weak-maps.mjs +1 -1
  32. package/fesm2015/plait-core.mjs +573 -433
  33. package/fesm2015/plait-core.mjs.map +1 -1
  34. package/fesm2020/plait-core.mjs +595 -456
  35. package/fesm2020/plait-core.mjs.map +1 -1
  36. package/interfaces/board.d.ts +19 -8
  37. package/interfaces/element.d.ts +5 -2
  38. package/interfaces/index.d.ts +2 -2
  39. package/interfaces/node.d.ts +0 -1
  40. package/interfaces/pointer.d.ts +4 -0
  41. package/interfaces/viewport.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/plugins/with-hand.d.ts +2 -0
  44. package/public-api.d.ts +2 -0
  45. package/transforms/board.d.ts +3 -0
  46. package/utils/board.d.ts +2 -3
  47. package/utils/matrix.d.ts +66 -16
  48. package/utils/weak-maps.d.ts +2 -2
  49. package/esm2020/interfaces/cursor.mjs +0 -7
  50. package/esm2020/interfaces/element-context.mjs +0 -2
  51. package/esm2020/plugins/with-move.mjs +0 -66
  52. package/interfaces/cursor.d.ts +0 -6
  53. package/interfaces/element-context.d.ts +0 -4
  54. package/plugins/with-move.d.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Input, EventEmitter, HostBinding, Output, ElementRef, ViewChild, ContentChild, NgModule } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, Input, EventEmitter, HostBinding, Output, ElementRef, ViewChild, ContentChild, Directive, NgModule } from '@angular/core';
3
3
  import rough from 'roughjs/bin/rough';
4
4
  import { Subject, fromEvent } from 'rxjs';
5
5
  import { takeUntil, filter } from 'rxjs/operators';
@@ -11,16 +11,21 @@ import { BrowserModule } from '@angular/platform-browser';
11
11
  const CLIP_BOARD_FORMAT_KEY = 'x-plait-fragment';
12
12
  const SCROLL_BAR_WIDTH = 20;
13
13
 
14
- var BaseCursorStatus;
15
- (function (BaseCursorStatus) {
16
- BaseCursorStatus["move"] = "move";
17
- BaseCursorStatus["select"] = "select";
18
- BaseCursorStatus["drag"] = "drag";
19
- })(BaseCursorStatus || (BaseCursorStatus = {}));
14
+ var PlaitPointerType;
15
+ (function (PlaitPointerType) {
16
+ PlaitPointerType["hand"] = "hand";
17
+ PlaitPointerType["selection"] = "selection";
18
+ })(PlaitPointerType || (PlaitPointerType = {}));
20
19
 
21
- /**
22
- * Extendable Custom Types Interface
23
- */
20
+ function isNullOrUndefined(value) {
21
+ return value === null || value === undefined;
22
+ }
23
+
24
+ const Viewport = {
25
+ isViewport: (value) => {
26
+ return (!isNullOrUndefined(value.zoom) && !isNullOrUndefined(value.viewBackgroundColor) && !isNullOrUndefined(value.originationCoord));
27
+ }
28
+ };
24
29
 
25
30
  const Path = {
26
31
  parent(path) {
@@ -155,7 +160,7 @@ const Path = {
155
160
  break;
156
161
  }
157
162
  }
158
- return null;
163
+ return p;
159
164
  });
160
165
  }
161
166
  };
@@ -179,93 +184,6 @@ const PlaitNode = {
179
184
  }
180
185
  };
181
186
 
182
- const isSetViewportOperation = (value) => {
183
- return value.type === 'set_viewport';
184
- };
185
- const inverse = (op) => {
186
- switch (op.type) {
187
- case 'insert_node': {
188
- return { ...op, type: 'remove_node' };
189
- }
190
- case 'remove_node': {
191
- return { ...op, type: 'insert_node' };
192
- }
193
- case 'move_node': {
194
- const { newPath, path } = op;
195
- // PERF: in this case the move operation is a no-op anyways.
196
- if (Path.equals(newPath, path)) {
197
- return op;
198
- }
199
- if (Path.isSibling(path, newPath)) {
200
- const inversePath = Path.transform(path, op);
201
- return { ...op, path: inversePath, newPath: path };
202
- }
203
- return { ...op, path: newPath, newPath: path };
204
- }
205
- case 'set_node': {
206
- const { properties, newProperties } = op;
207
- return { ...op, properties: newProperties, newProperties: properties };
208
- }
209
- case 'set_selection': {
210
- const { properties, newProperties } = op;
211
- if (properties == null) {
212
- return {
213
- ...op,
214
- properties: newProperties,
215
- newProperties: null
216
- };
217
- }
218
- else if (newProperties == null) {
219
- return {
220
- ...op,
221
- properties: null,
222
- newProperties: properties
223
- };
224
- }
225
- else {
226
- return { ...op, properties: newProperties, newProperties: properties };
227
- }
228
- }
229
- case 'set_viewport': {
230
- const { properties, newProperties } = op;
231
- if (properties == null) {
232
- return {
233
- ...op,
234
- properties: newProperties,
235
- newProperties: newProperties
236
- };
237
- }
238
- else if (newProperties == null) {
239
- return {
240
- ...op,
241
- properties: properties,
242
- newProperties: properties
243
- };
244
- }
245
- else {
246
- return { ...op, properties: newProperties, newProperties: properties };
247
- }
248
- }
249
- }
250
- };
251
- const PlaitOperation = {
252
- isSetViewportOperation,
253
- inverse
254
- };
255
-
256
- function isNullOrUndefined(value) {
257
- return value === null || value === undefined;
258
- }
259
-
260
- const Viewport = {
261
- isViewport: (value) => {
262
- return !isNullOrUndefined(value.zoom) && !isNullOrUndefined(value.viewBackgroundColor) && !isNullOrUndefined(value.canvasPoint);
263
- }
264
- };
265
-
266
- const SAVING = new WeakMap();
267
- const MERGING = new WeakMap();
268
-
269
187
  const applyToDraft = (board, selection, viewport, op) => {
270
188
  switch (op.type) {
271
189
  case 'insert_node': {
@@ -472,8 +390,7 @@ function createBoard(host, children, options) {
472
390
  host,
473
391
  viewport: {
474
392
  zoom: 1,
475
- viewBackgroundColor: '#000',
476
- canvasPoint: []
393
+ viewBackgroundColor: '#000'
477
394
  },
478
395
  children,
479
396
  operations: [],
@@ -482,7 +399,7 @@ function createBoard(host, children, options) {
482
399
  undos: []
483
400
  },
484
401
  selection: null,
485
- cursor: BaseCursorStatus.select,
402
+ pointer: PlaitPointerType.selection,
486
403
  options: options || {
487
404
  readonly: false,
488
405
  allowClearBoard: false,
@@ -513,8 +430,8 @@ function createBoard(host, children, options) {
513
430
  insertFragment: (data) => { },
514
431
  deleteFragment: (data) => { },
515
432
  drawElement: (context) => [],
516
- redrawElement: (context, changes) => [],
517
- destroyElement: () => { }
433
+ redrawElement: (context, previousContext) => { },
434
+ destroyElement: (context) => { }
518
435
  };
519
436
  return board;
520
437
  }
@@ -531,6 +448,96 @@ function withBoard(board) {
531
448
  return board;
532
449
  }
533
450
 
451
+ /**
452
+ * Extendable Custom Types Interface
453
+ */
454
+
455
+ const isSetViewportOperation = (value) => {
456
+ return value.type === 'set_viewport';
457
+ };
458
+ const inverse = (op) => {
459
+ switch (op.type) {
460
+ case 'insert_node': {
461
+ return { ...op, type: 'remove_node' };
462
+ }
463
+ case 'remove_node': {
464
+ return { ...op, type: 'insert_node' };
465
+ }
466
+ case 'move_node': {
467
+ const { newPath, path } = op;
468
+ // PERF: in this case the move operation is a no-op anyways.
469
+ if (Path.equals(newPath, path)) {
470
+ return op;
471
+ }
472
+ // when operation path is [0,0] -> [0,2], should exec Path.transform to get [0,1] -> [0,0]
473
+ // shoud not return [0,2] -> [0,0] #WIK-8981
474
+ // if (Path.isSibling(path, newPath)) {
475
+ // return { ...op, path: newPath, newPath: path };
476
+ // }
477
+ // If the move does not happen within a single parent it is possible
478
+ // for the move to impact the true path to the location where the node
479
+ // was removed from and where it was inserted. We have to adjust for this
480
+ // and find the original path. We can accomplish this (only in non-sibling)
481
+ // moves by looking at the impact of the move operation on the node
482
+ // after the original move path.
483
+ const inversePath = Path.transform(path, op);
484
+ const inverseNewPath = Path.transform(Path.next(path), op);
485
+ return { ...op, path: inversePath, newPath: inverseNewPath };
486
+ }
487
+ case 'set_node': {
488
+ const { properties, newProperties } = op;
489
+ return { ...op, properties: newProperties, newProperties: properties };
490
+ }
491
+ case 'set_selection': {
492
+ const { properties, newProperties } = op;
493
+ if (properties == null) {
494
+ return {
495
+ ...op,
496
+ properties: newProperties,
497
+ newProperties: null
498
+ };
499
+ }
500
+ else if (newProperties == null) {
501
+ return {
502
+ ...op,
503
+ properties: null,
504
+ newProperties: properties
505
+ };
506
+ }
507
+ else {
508
+ return { ...op, properties: newProperties, newProperties: properties };
509
+ }
510
+ }
511
+ case 'set_viewport': {
512
+ const { properties, newProperties } = op;
513
+ if (properties == null) {
514
+ return {
515
+ ...op,
516
+ properties: newProperties,
517
+ newProperties: newProperties
518
+ };
519
+ }
520
+ else if (newProperties == null) {
521
+ return {
522
+ ...op,
523
+ properties: properties,
524
+ newProperties: properties
525
+ };
526
+ }
527
+ else {
528
+ return { ...op, properties: newProperties, newProperties: properties };
529
+ }
530
+ }
531
+ }
532
+ };
533
+ const PlaitOperation = {
534
+ isSetViewportOperation,
535
+ inverse
536
+ };
537
+
538
+ const SAVING = new WeakMap();
539
+ const MERGING = new WeakMap();
540
+
534
541
  function transformPoints(board, points) {
535
542
  const newPoints = points.map(point => {
536
543
  return transformPoint(board, point);
@@ -545,17 +552,9 @@ function transformPoint(board, point) {
545
552
  const newPoint = [x, y];
546
553
  return newPoint;
547
554
  }
548
- function calculateZoom(zoom, minZoom = 0.2, maxZoom = 4) {
549
- return zoom < minZoom ? minZoom : zoom > maxZoom ? maxZoom : zoom;
550
- }
551
555
  function isNoSelectionElement(e) {
552
556
  return e.target?.closest('.plait-board-attached');
553
557
  }
554
- const updateCursorStatus = (board, cursor) => {
555
- if (cursor) {
556
- board.cursor = cursor;
557
- }
558
- };
559
558
 
560
559
  const NS = 'http://www.w3.org/2000/svg';
561
560
  function toPoint(x, y, container) {
@@ -813,73 +812,98 @@ function distanceBetweenPointAndPoint(x1, y1, x2, y2) {
813
812
  return Math.hypot(dx, dy);
814
813
  }
815
814
 
816
- function invert(oldMatrix, newMatrix) {
817
- let n = newMatrix[0], r = newMatrix[1], a = newMatrix[2], i = newMatrix[3], o = newMatrix[4], c = newMatrix[5], l = newMatrix[6], s = newMatrix[7], u = newMatrix[8], d = u * o - c * s, h = -u * i + c * l, f = s * i - o * l, p = n * d + r * h + a * f;
818
- return p
819
- ? ((p = 1 / p),
820
- (oldMatrix[0] = d * p),
821
- (oldMatrix[1] = (-u * r + a * s) * p),
822
- (oldMatrix[2] = (c * r - a * o) * p),
823
- (oldMatrix[3] = h * p),
824
- (oldMatrix[4] = (u * n - a * l) * p),
825
- (oldMatrix[5] = (-c * n + a * i) * p),
826
- (oldMatrix[6] = f * p),
827
- (oldMatrix[7] = (-s * n + r * l) * p),
828
- (oldMatrix[8] = (o * n - r * i) * p),
829
- oldMatrix)
830
- : null;
815
+ /**
816
+ * 逆矩阵
817
+ * [a c e]
818
+ * [b d f]
819
+ * [0 0 1]
820
+ * @param newMatrix 输出返回矩阵
821
+ * @param matrix 新矩阵
822
+ * @returns 逆矩阵
823
+ */
824
+ function invertMatrix(newMatrix, matrix) {
825
+ const [n, r, a, i, o, c, l, s, u] = matrix;
826
+ const determinant = u * o - c * s;
827
+ const h = -u * i + c * l;
828
+ const f = s * i - o * l;
829
+ const product = n * determinant + r * h + a * f;
830
+ if (!product) {
831
+ return null;
832
+ }
833
+ const reciprocal = 1 / product;
834
+ newMatrix[0] = determinant * reciprocal;
835
+ newMatrix[1] = (-u * r + a * s) * reciprocal;
836
+ newMatrix[2] = (c * r - a * o) * reciprocal;
837
+ newMatrix[3] = h * reciprocal;
838
+ newMatrix[4] = (u * n - a * l) * reciprocal;
839
+ newMatrix[5] = (-c * n + a * i) * reciprocal;
840
+ newMatrix[6] = f * reciprocal;
841
+ newMatrix[7] = (-s * n + r * l) * reciprocal;
842
+ newMatrix[8] = (o * n - r * i) * reciprocal;
843
+ return newMatrix;
831
844
  }
832
- function transformMat3(e, t, n) {
833
- e = [t[0] * n[0] + t[1] * n[3] + t[2] * n[6], t[0] * n[1] + t[1] * n[4] + t[2] * n[7], t[0] * n[2] + t[1] * n[5] + t[2] * n[8]];
834
- return e;
845
+ /**
846
+ * 将视图坐标与反转矩阵相乘,以得到原始坐标
847
+ * 使用给定的矩阵进行转换
848
+ * 矩阵与向量乘法,3 维向量与3x3矩阵的乘积
849
+ * [m11 m12 m13][v1]
850
+ * [m21 m22 m23][v2]
851
+ * [m31 m32 m33][v3]
852
+ * @param out 输出结果向量
853
+ * @param t 要转换的向量
854
+ * @param n 矩阵转换
855
+ * @returns [v1 * m11 + v2 * m12 + v3 * m13, v1 * m21 + v2 * m22 + v3 * m23, v1 * m31 + v2 * m32 + v3 * m33];
856
+ */
857
+ function transformMat3(out, vector, matrix) {
858
+ out = [
859
+ vector[0] * matrix[0] + vector[1] * matrix[3] + vector[2] * matrix[6],
860
+ vector[0] * matrix[1] + vector[1] * matrix[4] + vector[2] * matrix[7],
861
+ vector[0] * matrix[2] + vector[1] * matrix[5] + vector[2] * matrix[8]
862
+ ];
863
+ return out;
835
864
  }
836
- function convertPoint(arr) {
837
- return Array.isArray(arr)
865
+ /**
866
+ * 规范 point
867
+ * @param point
868
+ * @returns point
869
+ */
870
+ function normalizePoint(point) {
871
+ return Array.isArray(point)
838
872
  ? {
839
- x: arr[0],
840
- y: arr[1]
873
+ x: point[0],
874
+ y: point[1]
841
875
  }
842
- : arr;
843
- }
844
- function invertClient(board, point, matrix) {
845
- const convert = convertPoint(point);
846
- const clientBox = getViewportClientBox(board);
847
- const newPoint = [convert.x - clientBox.x, convert.y - clientBox.y, 1];
848
- const invertMatrix = invert([], matrix);
849
- const newMatrix = transformMat3([], [newPoint[0], newPoint[1], 1], invertMatrix);
850
- return [newMatrix[0], newMatrix[1]];
851
- }
852
- function invertViewport(point, matrix) {
853
- const newPoint = convertPoint(point);
854
- const invertMatrix = invert([], matrix);
855
- return transformMat3([], [newPoint.x, newPoint.y, 1], invertMatrix);
876
+ : point;
856
877
  }
857
- function convertViewport(point, matrix) {
858
- const newPoint = convertPoint(point);
859
- return transformMat3([], [newPoint.x, newPoint.y, 1], matrix);
878
+ /**
879
+ * 将一个点坐标反转回它的原始坐标
880
+ * @param point 表示要反转的点的视图坐标,它是一个长度为 2 的数组,存储点的 x y 坐标
881
+ * @param matrix 表示视图矩阵,是在视图中对图形进行缩放和平移时使用的矩阵
882
+ * @returns 最终结果是一个长度为 3 的数组,存储点的 x,y 和 w 坐标(w 坐标是点的齐次坐标)
883
+ */
884
+ function invertViewportCoordinates(point, matrix) {
885
+ const { x, y } = normalizePoint(point);
886
+ const invertedMatrix = invertMatrix([], matrix);
887
+ return transformMat3([], [x, y, 1], invertedMatrix);
860
888
  }
861
- function getViewportCanvasBox(board, matrix) {
862
- const clientBox = getViewportClientBox(board);
863
- const client = invertClient(board, [clientBox.minX, clientBox.minY], matrix);
864
- const newClient = invertClient(board, [clientBox.maxX, clientBox.maxY], matrix);
865
- return {
866
- minX: client[0],
867
- minY: client[1],
868
- maxX: newClient[0],
869
- maxY: newClient[1],
870
- x: client[0],
871
- y: client[1],
872
- width: newClient[0] - client[0],
873
- height: newClient[1] - client[1]
874
- };
889
+ function convertToViewportCoordinates(point, matrix) {
890
+ const { x, y } = normalizePoint(point);
891
+ return transformMat3([], [x, y, 1], matrix);
875
892
  }
876
- function getViewportClientBox(board) {
893
+ /**
894
+ * 获取 contentContainer 的 clientBox
895
+ * @param board
896
+ * @returns
897
+ */
898
+ function getViewportContainerBox(board) {
899
+ const { hideScrollbar } = board.options;
900
+ const scrollBarWidth = hideScrollbar ? SCROLL_BAR_WIDTH : 0;
877
901
  const container = board.host?.parentElement;
878
902
  const containerRect = container?.getBoundingClientRect();
879
903
  const x = containerRect.x || containerRect.left;
880
904
  const y = containerRect.y || containerRect.top;
881
- const width = containerRect.width - SCROLL_BAR_WIDTH;
882
- const height = containerRect.height - SCROLL_BAR_WIDTH;
905
+ const width = containerRect.width - scrollBarWidth;
906
+ const height = containerRect.height - scrollBarWidth;
883
907
  return {
884
908
  minX: x,
885
909
  minY: y,
@@ -891,41 +915,70 @@ function getViewportClientBox(board) {
891
915
  height
892
916
  };
893
917
  }
894
- function getGraphicsBBox(board) {
895
- const rootGroup = board.host.firstChild;
896
- const rootGroupBox = rootGroup.getBBox();
897
- return rootGroupBox;
918
+ /**
919
+ * 获取 board.plait-board 的 clientBox
920
+ * @param board
921
+ * @returns
922
+ */
923
+ function getBoardClientBox(board) {
924
+ const { hideScrollbar } = board.options;
925
+ const scrollBarWidth = hideScrollbar ? SCROLL_BAR_WIDTH : 0;
926
+ const boardEl = board.host?.parentElement?.parentElement;
927
+ const elRect = boardEl?.getBoundingClientRect();
928
+ return {
929
+ width: elRect.width + scrollBarWidth,
930
+ height: elRect.height + scrollBarWidth
931
+ };
898
932
  }
899
- function calculateBBox(board, zoom) {
900
- const boardComponent = PLAIT_BOARD_TO_COMPONENT.get(board);
901
- // const clientBox = getViewportClientBox(board);
933
+ /**
934
+ * 获取 rootGroup 相对于当前 svg 空间的最小矩阵坐标
935
+ */
936
+ function getRootGroupBBox(board, zoom) {
902
937
  const rootGroup = board.host.firstChild;
903
938
  const rootGroupBox = rootGroup.getBBox();
904
- let box = {};
905
- const containerWidth = boardComponent.width / zoom;
906
- const containerHeight = boardComponent.height / zoom;
939
+ const viewportContainerBox = getViewportContainerBox(board);
940
+ const containerWidth = viewportContainerBox.width / zoom;
941
+ const containerHeight = viewportContainerBox.height / zoom;
942
+ let left;
943
+ let right;
944
+ let top;
945
+ let bottom;
907
946
  if (rootGroupBox.width < containerWidth) {
908
947
  const offsetX = rootGroupBox.x + rootGroupBox.width / 2;
909
948
  const containerX = containerWidth / 2;
910
- box.left = offsetX - containerX;
911
- box.right = offsetX + containerX;
949
+ left = offsetX - containerX;
950
+ right = offsetX + containerX;
912
951
  }
913
952
  else {
914
- box.left = rootGroupBox.x;
915
- box.right = rootGroupBox.x + rootGroupBox.width;
953
+ left = rootGroupBox.x;
954
+ right = rootGroupBox.x + rootGroupBox.width;
916
955
  }
917
956
  if (rootGroupBox.height < containerHeight) {
918
957
  const offsetY = rootGroupBox.y + rootGroupBox.height / 2;
919
958
  const containerY = containerHeight / 2;
920
- box.top = offsetY - containerY;
921
- box.bottom = offsetY + containerY;
959
+ top = offsetY - containerY;
960
+ bottom = offsetY + containerY;
922
961
  }
923
962
  else {
924
- box.top = rootGroupBox.y;
925
- box.bottom = rootGroupBox.y + rootGroupBox.height;
963
+ top = rootGroupBox.y;
964
+ bottom = rootGroupBox.y + rootGroupBox.height;
926
965
  }
927
- // 在新的缩放比容器宽高下的内容盒子位置
928
- return box;
966
+ return {
967
+ left,
968
+ right,
969
+ top,
970
+ bottom
971
+ };
972
+ }
973
+ /**
974
+ * 验证缩放比是否符合限制,如果超出限制,则返回合适的缩放比
975
+ * @param zoom 缩放比
976
+ * @param minZoom 最小缩放比
977
+ * @param maxZoom 最大缩放比
978
+ * @returns 正确的缩放比
979
+ */
980
+ function clampZoomLevel(zoom, minZoom = 0.2, maxZoom = 4) {
981
+ return zoom < minZoom ? minZoom : zoom > maxZoom ? maxZoom : zoom;
929
982
  }
930
983
 
931
984
  function withHistory(board) {
@@ -1012,7 +1065,13 @@ function withHistory(board) {
1012
1065
  return board;
1013
1066
  }
1014
1067
 
1015
- function withMove(board) {
1068
+ const updatePointerType = (board, pointer) => {
1069
+ board.pointer = pointer;
1070
+ const boardComponent = PLAIT_BOARD_TO_COMPONENT.get(board);
1071
+ boardComponent?.markForCheck();
1072
+ };
1073
+
1074
+ function withHandPointer(board) {
1016
1075
  const { mousedown, mousemove, globalMouseup, keydown, keyup } = board;
1017
1076
  const plaitBoardMove = {
1018
1077
  x: 0,
@@ -1020,12 +1079,12 @@ function withMove(board) {
1020
1079
  };
1021
1080
  board.mousedown = (event) => {
1022
1081
  if (board.options.readonly) {
1023
- updateCursorStatus(board, BaseCursorStatus.move);
1082
+ updatePointerType(board, PlaitPointerType.hand);
1024
1083
  }
1025
1084
  else if (!board.selection) {
1026
- updateCursorStatus(board, BaseCursorStatus.select);
1085
+ updatePointerType(board, PlaitPointerType.selection);
1027
1086
  }
1028
- if (board.cursor === BaseCursorStatus.move && board.selection) {
1087
+ if (board.pointer === PlaitPointerType.hand && board.selection) {
1029
1088
  const boardComponent = PLAIT_BOARD_TO_COMPONENT.get(board);
1030
1089
  boardComponent.movingChange(true);
1031
1090
  plaitBoardMove.x = event.x;
@@ -1036,10 +1095,11 @@ function withMove(board) {
1036
1095
  };
1037
1096
  board.mousemove = (event) => {
1038
1097
  const boardComponent = PLAIT_BOARD_TO_COMPONENT.get(board);
1039
- if (board.cursor === BaseCursorStatus.move && board.selection && boardComponent.isMoving) {
1098
+ if (board.pointer === PlaitPointerType.hand && board.selection && boardComponent.isMoving) {
1040
1099
  const left = event.x - plaitBoardMove.x;
1041
1100
  const top = event.y - plaitBoardMove.y;
1042
- boardComponent.setScroll(boardComponent.scrollLeft - left, boardComponent.scrollTop - top);
1101
+ const { scrollLeft, scrollTop } = boardComponent.viewportState;
1102
+ boardComponent.setScroll(scrollLeft - left, scrollTop - top);
1043
1103
  plaitBoardMove.x = event.x;
1044
1104
  plaitBoardMove.y = event.y;
1045
1105
  }
@@ -1056,8 +1116,8 @@ function withMove(board) {
1056
1116
  };
1057
1117
  board.keydown = (event) => {
1058
1118
  if (board.selection && event.code === 'Space') {
1059
- if (board.cursor !== BaseCursorStatus.move) {
1060
- updateCursorStatus(board, BaseCursorStatus.move);
1119
+ if (board.pointer !== PlaitPointerType.hand) {
1120
+ updatePointerType(board, PlaitPointerType.hand);
1061
1121
  const boardComponent = PLAIT_BOARD_TO_COMPONENT.get(board);
1062
1122
  boardComponent.cdr.markForCheck();
1063
1123
  }
@@ -1067,7 +1127,7 @@ function withMove(board) {
1067
1127
  };
1068
1128
  board.keyup = (event) => {
1069
1129
  if (board.selection && !board.options.readonly && event.code === 'Space') {
1070
- updateCursorStatus(board, BaseCursorStatus.select);
1130
+ updatePointerType(board, PlaitPointerType.selection);
1071
1131
  const boardComponent = PLAIT_BOARD_TO_COMPONENT.get(board);
1072
1132
  boardComponent.cdr.markForCheck();
1073
1133
  }
@@ -1108,7 +1168,9 @@ function withSelection(board) {
1108
1168
  Transforms.setSelection(board, { anchor: start, focus: start });
1109
1169
  }
1110
1170
  else {
1111
- Transforms.setSelection(board, null);
1171
+ if (board.selection !== null) {
1172
+ Transforms.setSelection(board, null);
1173
+ }
1112
1174
  }
1113
1175
  start = null;
1114
1176
  end = null;
@@ -1130,24 +1192,60 @@ class PlaitElementComponent {
1130
1192
  }
1131
1193
  initialize() {
1132
1194
  this.initialized = true;
1133
- this.groupG = createG();
1134
- this.renderer2.setAttribute(this.groupG, 'plait-element-group', this.index.toString());
1135
- this.host.append(this.groupG);
1195
+ this.gGroup = createG();
1196
+ this.renderer2.setAttribute(this.gGroup, 'plait-element-group', this.index.toString());
1197
+ this.host.append(this.gGroup);
1136
1198
  }
1137
1199
  drawElement() {
1138
- const gArray = this.board.drawElement({ elementInstance: this });
1139
- gArray.forEach(g => {
1140
- this.groupG.appendChild(g);
1141
- });
1200
+ const context = this.getContext();
1201
+ const result = this.board.drawElement(context.current);
1202
+ if (Array.isArray(result)) {
1203
+ result.forEach(g => {
1204
+ this.gGroup.appendChild(g);
1205
+ });
1206
+ }
1207
+ else {
1208
+ const componentRef = this.viewContainerRef.createComponent(result);
1209
+ const instance = componentRef.instance;
1210
+ instance.context = context.current;
1211
+ this.gGroup.appendChild(instance.g);
1212
+ this.instance = instance;
1213
+ }
1142
1214
  }
1143
- ngOnChanges(changes) {
1215
+ ngOnChanges() {
1144
1216
  if (this.initialized) {
1145
- this.board.redrawElement({ elementInstance: this }, changes);
1217
+ const context = this.getContext();
1218
+ if (this.instance) {
1219
+ this.instance.context = context.current;
1220
+ }
1221
+ const result = this.board.redrawElement(context.current, context.previous);
1222
+ if (result && result.length > 0) {
1223
+ this.gGroup.childNodes.forEach(g => g.remove());
1224
+ result.forEach(g => {
1225
+ this.gGroup.appendChild(g);
1226
+ });
1227
+ }
1228
+ }
1229
+ }
1230
+ getContext() {
1231
+ const current = {
1232
+ element: this.element,
1233
+ selection: this.selection,
1234
+ board: this.board,
1235
+ host: this.host
1236
+ };
1237
+ if (this.context) {
1238
+ const previous = { ...this.context };
1239
+ this.context = current;
1240
+ return { current, previous };
1241
+ }
1242
+ else {
1243
+ return { current };
1146
1244
  }
1147
1245
  }
1148
1246
  ngOnDestroy() {
1149
- this.board.destroyElement();
1150
- this.groupG.remove();
1247
+ this.gGroup.remove();
1248
+ this.board.destroyElement(this.getContext().current);
1151
1249
  }
1152
1250
  }
1153
1251
  PlaitElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlaitElementComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
@@ -1175,27 +1273,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1175
1273
 
1176
1274
  class PlaitToolbarComponent {
1177
1275
  constructor() {
1178
- this._viewZoom = 100;
1276
+ this.PlaitPointerType = PlaitPointerType;
1179
1277
  this.hostClass = `plait-board-toolbar`;
1180
- this.moveHandle = new EventEmitter();
1181
1278
  this.adaptHandle = new EventEmitter();
1182
1279
  this.zoomInHandle = new EventEmitter();
1183
1280
  this.zoomOutHandle = new EventEmitter();
1184
1281
  this.resetZoomHandel = new EventEmitter();
1185
1282
  }
1186
- set viewZoom(zoom) {
1187
- this._viewZoom = Number(((zoom ?? 1) * 100).toFixed(0));
1283
+ get zoom() {
1284
+ const zoom = this.board?.viewport.zoom || 1;
1285
+ return Number((zoom * 100).toFixed(0));
1188
1286
  }
1189
- get viewZoom() {
1190
- return this._viewZoom;
1287
+ get pointerType() {
1288
+ return this.board.pointer || PlaitPointerType.selection;
1191
1289
  }
1192
- dragMove() {
1193
- if (this.cursorStatus !== BaseCursorStatus.move) {
1194
- this.moveHandle.emit(BaseCursorStatus.move);
1195
- }
1196
- else {
1197
- this.moveHandle.emit(BaseCursorStatus.select);
1198
- }
1290
+ activeHand() {
1291
+ updatePointerType(this.board, this.pointerType === PlaitPointerType.hand ? PlaitPointerType.selection : PlaitPointerType.hand);
1199
1292
  }
1200
1293
  // 适应画布
1201
1294
  adapt() {
@@ -1214,19 +1307,15 @@ class PlaitToolbarComponent {
1214
1307
  }
1215
1308
  }
1216
1309
  PlaitToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlaitToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1217
- PlaitToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PlaitToolbarComponent, selector: "plait-toolbar", inputs: { cursorStatus: "cursorStatus", viewZoom: "viewZoom" }, outputs: { moveHandle: "moveHandle", adaptHandle: "adaptHandle", zoomInHandle: "zoomInHandle", zoomOutHandle: "zoomOutHandle", resetZoomHandel: "resetZoomHandel" }, host: { properties: { "class": "this.hostClass" } }, ngImport: i0, template: "<div class=\"zoom-toolbar island plait-board-attached\">\n <a class=\"toolbar-item plait-action-icon\" [ngClass]=\"{ 'icon-active': cursorStatus === 'move' }\" (click)=\"dragMove()\">\n <ng-template [ngTemplateOutlet]=\"dragMoveTemplate\"></ng-template>\n </a>\n <div class=\"divider\"></div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"adapt()\">\n <ng-template [ngTemplateOutlet]=\"adaptTemplate\"></ng-template>\n </a>\n <div class=\"divider\"></div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"zoomOut()\">\n <ng-template [ngTemplateOutlet]=\"zoomOutTemplate\"></ng-template>\n </a>\n <div class=\"toolbar-item zoom-value\" (mousedown)=\"resetZoom()\">{{ viewZoom }}%</div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"zoomIn()\">\n <ng-template [ngTemplateOutlet]=\"zoomInTemplate\"></ng-template>\n </a>\n</div>\n\n<ng-template #dragMoveTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/hand</title>\n <g id=\"1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/hand\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M8.44583468,0.500225887 C9.07406934,0.510185679 9.54739531,0.839591366 9.86192311,1.34305279 C9.89696656,1.39914649 9.92878401,1.45492964 9.9576026,1.50991157 L9.9576026,1.50991157 L10.0210033,1.64201027 L10.061978,1.62350755 C10.1972891,1.56834247 10.3444107,1.53218464 10.5027907,1.51755353 L10.5027907,1.51755353 L10.6649031,1.51019133 C11.4883708,1.51019133 12.0208782,1.99343346 12.3023042,2.66393278 C12.3903714,2.87392911 12.4344191,3.10047818 12.4339446,3.3257952 L12.4339446,3.3257952 L12.4360033,3.80501027 L12.5160535,3.78341501 C12.6124478,3.76124046 12.7138812,3.74739854 12.820201,3.74250274 L12.820201,3.74250274 L12.9833264,3.74194533 C13.6121166,3.7657478 14.0645887,4.0801724 14.3087062,4.56112689 C14.4521117,4.8436609 14.4987984,5.11349437 14.4999262,5.33449618 L14.4999262,5.33449618 L14.3922653,12.049414 C14.3784752,12.909177 14.0717787,13.7360948 13.5212406,14.3825228 C13.4055676,14.5183496 13.2843697,14.643961 13.1582361,14.7596335 C12.4634771,15.3967716 11.755103,15.6538706 11.1897396,15.7000055 L11.1897396,15.7000055 L7.4723083,15.6798158 C7.14276373,15.634268 6.81580098,15.5154267 6.49455235,15.3472501 C6.25643701,15.2225944 6.06881706,15.0975452 5.88705731,14.9494308 L5.88705731,14.9494308 L2.55198782,11.500873 C2.39559475,11.3769079 2.17626793,11.1748532 1.9548636,10.9139403 C1.57867502,10.4706225 1.33501976,10.0139923 1.30330257,9.52833025 C1.28093191,9.18578476 1.37200912,8.85641102 1.5826788,8.56872564 C1.82538833,8.23725279 2.12881965,8.02107162 2.47470569,7.92957033 C2.95807982,7.80169771 3.42705723,7.92468989 3.86509644,8.18731167 C4.04431391,8.29475961 4.1816109,8.40304483 4.26225571,8.47866867 L4.26225571,8.47866867 L4.61400328,8.79701027 L4.57247249,3.59275349 L4.57628524,3.46204923 C4.5897691,3.23444442 4.64087578,2.95701848 4.75937106,2.66961597 C5.01017272,2.06131302 5.49670227,1.64692543 6.21363856,1.60818786 C6.44223508,1.59583681 6.65042099,1.62176802 6.83696985,1.68057551 L6.83696985,1.68057551 L6.86400328,1.69001027 C6.88501862,1.63593052 6.90764242,1.58175442 6.9331867,1.52672633 L6.9331867,1.52672633 L7.01883595,1.35955614 C7.31549194,0.832047939 7.79476072,0.48993549 8.44583468,0.500225887 Z M8.42684173,1.70001476 C8.26825412,1.69756905 8.16339456,1.77242008 8.06478367,1.94776814 C8.03967773,1.99241107 8.01831703,2.03811495 8.00083464,2.07855067 L8.00083464,2.07855067 L7.94879157,2.2035905 L7.94354455,2.20731401 L7.943,3.161 L7.97170661,3.16123746 L7.97170661,7.60991883 L6.77170661,7.60991883 L6.771,3.338 L6.74362358,3.33880359 C6.74284189,3.29064626 6.73014163,3.20282206 6.7002616,3.11094408 L6.66446012,3.01903385 C6.58982025,2.85766739 6.49843292,2.79455071 6.27838133,2.80644008 C6.07001018,2.81769881 5.95642108,2.91444507 5.86877664,3.12702089 C5.79792279,3.29887224 5.77228127,3.48655908 5.77246879,3.58977183 L5.77246879,3.58977183 L5.83613619,11.5252021 L3.41863956,9.33477657 L3.31637296,9.25979571 L3.24805011,9.21651224 C3.06096922,9.10434987 2.89279975,9.06024641 2.78159879,9.0896637 C2.71007735,9.10858411 2.63607367,9.1613084 2.55086305,9.27768211 C2.51020424,9.33320478 2.49638061,9.38319687 2.50075171,9.4501283 C2.51206889,9.62341997 2.64503022,9.87260054 2.86983366,10.1375191 C3.03268834,10.3294345 3.19762053,10.4813781 3.35554956,10.6131022 L3.35554956,10.6131022 L6.68454317,14.0569073 C6.71106575,14.0773808 6.74806086,14.1037158 6.79369091,14.1335929 L6.79369091,14.1335929 L6.95464838,14.2315311 L7.05111031,14.2841211 C7.25978123,14.3933622 7.46253523,14.4670573 7.55685495,14.4854708 L7.55685495,14.4854708 L11.1407985,14.5022108 C11.1503576,14.5013899 11.1627905,14.4997539 11.1779002,14.4971772 L11.1779002,14.4971772 L11.2991076,14.4694224 C11.3491682,14.4557375 11.4083624,14.437284 11.4751158,14.4130563 C11.769383,14.3062543 12.066676,14.1324596 12.3471758,13.8752234 C12.4371203,13.7927386 12.5240597,13.7026333 12.607654,13.6044743 C12.9760464,13.1719172 13.183059,12.6137678 13.1924195,12.030173 L13.1924195,12.030173 L13.3000132,5.32832551 C13.2997939,5.29016685 13.2826117,5.19085946 13.2386527,5.10425262 C13.1843838,4.99733326 13.1129774,4.94771265 12.9379578,4.94108739 C12.6814739,4.93138871 12.534132,5.11189595 12.4756792,5.39480062 L12.4768718,7.52734922 L11.2768718,7.52734922 L11.276,5.688 L11.2462883,5.6883208 L11.2339541,3.32771285 C11.2341,3.2560396 11.2209054,3.18817621 11.1957482,3.12818892 C11.0820579,2.85732094 10.9199288,2.71019133 10.6649031,2.71019133 C10.456829,2.71019133 10.3197487,2.87378067 10.2524297,3.11264939 L10.2530225,7.512783 L9.05302254,7.512783 L9.053,3.288 L9.01554331,3.28724203 L8.98800328,2.29901027 L8.9629175,2.22263368 C8.94515567,2.17417174 8.92167756,2.11937748 8.8924232,2.06330056 L8.8924232,2.06330056 L8.84420197,1.9788544 C8.72758855,1.79219249 8.59915015,1.70280728 8.42684173,1.70001476 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n\n<ng-template #adaptTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/Fit canvas</title>\n <g id=\"1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/Fit-canvas\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M14.9971494,10.4 L14.9971494,13.4020516 C14.9971494,14.2366152 14.3581879,14.9219414 13.542782,14.9955129 L13.3971494,15.0020516 L10.4,15.0020516 L10.4,13.8020516 L13.3971494,13.8020516 C13.590449,13.8020516 13.7517243,13.6649388 13.7890228,13.4826656 L13.7971494,13.4020516 L13.7971494,10.4 L14.9971494,10.4 Z M2.2,10.4 L2.2,13.3971494 C2.2,13.590449 2.3371128,13.7517243 2.51938605,13.7890228 L2.6,13.7971494 L5.60205161,13.7971494 L5.60205161,14.9971494 L2.6,14.9971494 C1.76543638,14.9971494 1.08011021,14.3581879 1.00653868,13.542782 L1,13.3971494 L1,10.4 L2.2,10.4 Z M10.5024511,4.9 C11.3861067,4.9 12.1024511,5.6163444 12.1024511,6.5 L12.1024511,6.5 L12.1024511,9.5 C12.1024511,10.3836556 11.3861067,11.1 10.5024511,11.1 L10.5024511,11.1 L5.50245112,11.1 C4.61879552,11.1 3.90245112,10.3836556 3.90245112,9.5 L3.90245112,9.5 L3.90245112,6.5 C3.90245112,5.6163444 4.61879552,4.9 5.50245112,4.9 L5.50245112,4.9 Z M10.5024511,6.1 L5.50245112,6.1 C5.28153722,6.1 5.10245112,6.2790861 5.10245112,6.5 L5.10245112,6.5 L5.10245112,9.5 C5.10245112,9.7209139 5.28153722,9.9 5.50245112,9.9 L5.50245112,9.9 L10.5024511,9.9 C10.723365,9.9 10.9024511,9.7209139 10.9024511,9.5 L10.9024511,9.5 L10.9024511,6.5 C10.9024511,6.2790861 10.723365,6.1 10.5024511,6.1 L10.5024511,6.1 Z M5.59714938,1 L5.59714938,2.2 L2.6,2.2 C2.40670034,2.2 2.24542508,2.3371128 2.20812658,2.51938605 L2.2,2.6 L2.2,5.60205161 L1,5.60205161 L1,2.6 C1,1.76543638 1.63896152,1.08011021 2.45436739,1.00653868 L2.6,1 L5.59714938,1 Z M13.3971494,1 L13.542782,1.00653868 C14.3581879,1.08011021 14.9971494,1.76543638 14.9971494,2.6 L14.9971494,2.6 L14.9971494,5.60205161 L13.7971494,5.60205161 L13.7971494,2.6 L13.7890228,2.51938605 C13.7517243,2.3371128 13.590449,2.2 13.3971494,2.2 L13.3971494,2.2 L10.4,2.2 L10.4,1 L13.3971494,1 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n<ng-template #zoomOutTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>action/zoom-out</title>\n <desc>Created with Sketch.</desc>\n <g id=\"action/zoom-out\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M6.85,2.73225886e-13 C10.6331505,2.73225886e-13 13.7,3.06684946 13.7,6.85 C13.7,8.54194045 13.0865836,10.0906098 12.0700142,11.2857448 L15.4201976,14.5717081 C15.6567367,14.8037768 15.6603607,15.1836585 15.4282919,15.4201976 C15.1962232,15.6567367 14.8163415,15.6603607 14.5798024,15.4282919 L14.5798024,15.4282919 L11.2163456,12.128262 C10.0309427,13.1099691 8.50937591,13.7 6.85,13.7 C3.06684946,13.7 4.58522109e-14,10.6331505 4.58522109e-14,6.85 C4.58522109e-14,3.06684946 3.06684946,2.73225886e-13 6.85,2.73225886e-13 Z M6.85,1.2 C3.72959116,1.2 1.2,3.72959116 1.2,6.85 C1.2,9.97040884 3.72959116,12.5 6.85,12.5 C8.31753357,12.5 9.65438791,11.9404957 10.6588859,11.0231643 C10.6855412,10.9625408 10.7245275,10.9050898 10.7743982,10.8542584 C10.8288931,10.7987137 10.8915387,10.7560124 10.9585649,10.7261903 C11.9144009,9.71595758 12.5,8.35136579 12.5,6.85 C12.5,3.72959116 9.97040884,1.2 6.85,1.2 Z M4.6,6.2 L9.12944565,6.2 C9.4608165,6.2 9.72944565,6.46862915 9.72944565,6.8 C9.72944565,7.09823376 9.51185604,7.34564675 9.22676876,7.39214701 L9.12944565,7.4 L4.6,7.4 C4.26862915,7.4 4,7.13137085 4,6.8 C4,6.50176624 4.21758961,6.25435325 4.50267688,6.20785299 L4.6,6.2 L9.12944565,6.2 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n\n<ng-template #zoomInTemplate\n ><svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>action/zoom-in</title>\n <desc>Created with Sketch.</desc>\n <g id=\"action/zoom-in\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M6.85,-1.81188398e-13 C10.6331505,-1.81188398e-13 13.7,3.06684946 13.7,6.85 C13.7,8.54194045 13.0865836,10.0906098 12.0700142,11.2857448 L15.4201976,14.5717081 C15.6567367,14.8037768 15.6603607,15.1836585 15.4282919,15.4201976 C15.1962232,15.6567367 14.8163415,15.6603607 14.5798024,15.4282919 L14.5798024,15.4282919 L11.2163456,12.128262 C10.0309427,13.1099691 8.50937591,13.7 6.85,13.7 C3.06684946,13.7 4.61852778e-14,10.6331505 4.61852778e-14,6.85 C4.61852778e-14,3.06684946 3.06684946,-1.81188398e-13 6.85,-1.81188398e-13 Z M6.85,1.2 C3.72959116,1.2 1.2,3.72959116 1.2,6.85 C1.2,9.97040884 3.72959116,12.5 6.85,12.5 C8.31753357,12.5 9.65438791,11.9404957 10.6588859,11.0231643 C10.6855412,10.9625408 10.7245275,10.9050898 10.7743982,10.8542584 C10.8288931,10.7987137 10.8915387,10.7560124 10.9585649,10.7261903 C11.9144009,9.71595758 12.5,8.35136579 12.5,6.85 C12.5,3.72959116 9.97040884,1.2 6.85,1.2 Z M6.86472282,3.93527718 C7.16295659,3.93527718 7.41036958,4.15286679 7.45686984,4.43795406 L7.46472282,4.53527718 L7.464,6.19927718 L9.12944565,6.2 C9.42767941,6.2 9.6750924,6.41758961 9.72159266,6.70267688 L9.72944565,6.8 C9.72944565,7.09823376 9.51185604,7.34564675 9.22676876,7.39214701 L9.12944565,7.4 L7.464,7.39927718 L7.46472282,9.06472282 C7.46472282,9.36295659 7.24713321,9.61036958 6.96204594,9.65686984 L6.86472282,9.66472282 C6.56648906,9.66472282 6.31907607,9.44713321 6.27257581,9.16204594 L6.26472282,9.06472282 L6.264,7.39927718 L4.6,7.4 C4.30176624,7.4 4.05435325,7.18241039 4.00785299,6.89732312 L4,6.8 C4,6.50176624 4.21758961,6.25435325 4.50267688,6.20785299 L4.6,6.2 L6.264,6.19927718 L6.26472282,4.53527718 C6.26472282,4.2701805 6.43664548,4.0452385 6.67507642,3.96586557 L6.76739971,3.94313016 L6.86472282,3.93527718 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n", directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1310
+ PlaitToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PlaitToolbarComponent, selector: "plait-toolbar", inputs: { board: "board" }, outputs: { adaptHandle: "adaptHandle", zoomInHandle: "zoomInHandle", zoomOutHandle: "zoomOutHandle", resetZoomHandel: "resetZoomHandel" }, host: { properties: { "class": "this.hostClass" } }, ngImport: i0, template: "<div class=\"zoom-toolbar island plait-board-attached\">\n <a class=\"toolbar-item plait-action-icon\" [ngClass]=\"{ 'icon-active': pointerType === PlaitPointerType.hand}\" (click)=\"activeHand()\">\n <ng-template [ngTemplateOutlet]=\"dragMoveTemplate\"></ng-template>\n </a>\n <div class=\"divider\"></div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"adapt()\">\n <ng-template [ngTemplateOutlet]=\"adaptTemplate\"></ng-template>\n </a>\n <div class=\"divider\"></div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"zoomOut()\">\n <ng-template [ngTemplateOutlet]=\"zoomOutTemplate\"></ng-template>\n </a>\n <div class=\"toolbar-item zoom-value\" (mousedown)=\"resetZoom()\">{{ zoom }}%</div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"zoomIn()\">\n <ng-template [ngTemplateOutlet]=\"zoomInTemplate\"></ng-template>\n </a>\n</div>\n\n<ng-template #dragMoveTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/hand</title>\n <g id=\"1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/hand\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M8.44583468,0.500225887 C9.07406934,0.510185679 9.54739531,0.839591366 9.86192311,1.34305279 C9.89696656,1.39914649 9.92878401,1.45492964 9.9576026,1.50991157 L9.9576026,1.50991157 L10.0210033,1.64201027 L10.061978,1.62350755 C10.1972891,1.56834247 10.3444107,1.53218464 10.5027907,1.51755353 L10.5027907,1.51755353 L10.6649031,1.51019133 C11.4883708,1.51019133 12.0208782,1.99343346 12.3023042,2.66393278 C12.3903714,2.87392911 12.4344191,3.10047818 12.4339446,3.3257952 L12.4339446,3.3257952 L12.4360033,3.80501027 L12.5160535,3.78341501 C12.6124478,3.76124046 12.7138812,3.74739854 12.820201,3.74250274 L12.820201,3.74250274 L12.9833264,3.74194533 C13.6121166,3.7657478 14.0645887,4.0801724 14.3087062,4.56112689 C14.4521117,4.8436609 14.4987984,5.11349437 14.4999262,5.33449618 L14.4999262,5.33449618 L14.3922653,12.049414 C14.3784752,12.909177 14.0717787,13.7360948 13.5212406,14.3825228 C13.4055676,14.5183496 13.2843697,14.643961 13.1582361,14.7596335 C12.4634771,15.3967716 11.755103,15.6538706 11.1897396,15.7000055 L11.1897396,15.7000055 L7.4723083,15.6798158 C7.14276373,15.634268 6.81580098,15.5154267 6.49455235,15.3472501 C6.25643701,15.2225944 6.06881706,15.0975452 5.88705731,14.9494308 L5.88705731,14.9494308 L2.55198782,11.500873 C2.39559475,11.3769079 2.17626793,11.1748532 1.9548636,10.9139403 C1.57867502,10.4706225 1.33501976,10.0139923 1.30330257,9.52833025 C1.28093191,9.18578476 1.37200912,8.85641102 1.5826788,8.56872564 C1.82538833,8.23725279 2.12881965,8.02107162 2.47470569,7.92957033 C2.95807982,7.80169771 3.42705723,7.92468989 3.86509644,8.18731167 C4.04431391,8.29475961 4.1816109,8.40304483 4.26225571,8.47866867 L4.26225571,8.47866867 L4.61400328,8.79701027 L4.57247249,3.59275349 L4.57628524,3.46204923 C4.5897691,3.23444442 4.64087578,2.95701848 4.75937106,2.66961597 C5.01017272,2.06131302 5.49670227,1.64692543 6.21363856,1.60818786 C6.44223508,1.59583681 6.65042099,1.62176802 6.83696985,1.68057551 L6.83696985,1.68057551 L6.86400328,1.69001027 C6.88501862,1.63593052 6.90764242,1.58175442 6.9331867,1.52672633 L6.9331867,1.52672633 L7.01883595,1.35955614 C7.31549194,0.832047939 7.79476072,0.48993549 8.44583468,0.500225887 Z M8.42684173,1.70001476 C8.26825412,1.69756905 8.16339456,1.77242008 8.06478367,1.94776814 C8.03967773,1.99241107 8.01831703,2.03811495 8.00083464,2.07855067 L8.00083464,2.07855067 L7.94879157,2.2035905 L7.94354455,2.20731401 L7.943,3.161 L7.97170661,3.16123746 L7.97170661,7.60991883 L6.77170661,7.60991883 L6.771,3.338 L6.74362358,3.33880359 C6.74284189,3.29064626 6.73014163,3.20282206 6.7002616,3.11094408 L6.66446012,3.01903385 C6.58982025,2.85766739 6.49843292,2.79455071 6.27838133,2.80644008 C6.07001018,2.81769881 5.95642108,2.91444507 5.86877664,3.12702089 C5.79792279,3.29887224 5.77228127,3.48655908 5.77246879,3.58977183 L5.77246879,3.58977183 L5.83613619,11.5252021 L3.41863956,9.33477657 L3.31637296,9.25979571 L3.24805011,9.21651224 C3.06096922,9.10434987 2.89279975,9.06024641 2.78159879,9.0896637 C2.71007735,9.10858411 2.63607367,9.1613084 2.55086305,9.27768211 C2.51020424,9.33320478 2.49638061,9.38319687 2.50075171,9.4501283 C2.51206889,9.62341997 2.64503022,9.87260054 2.86983366,10.1375191 C3.03268834,10.3294345 3.19762053,10.4813781 3.35554956,10.6131022 L3.35554956,10.6131022 L6.68454317,14.0569073 C6.71106575,14.0773808 6.74806086,14.1037158 6.79369091,14.1335929 L6.79369091,14.1335929 L6.95464838,14.2315311 L7.05111031,14.2841211 C7.25978123,14.3933622 7.46253523,14.4670573 7.55685495,14.4854708 L7.55685495,14.4854708 L11.1407985,14.5022108 C11.1503576,14.5013899 11.1627905,14.4997539 11.1779002,14.4971772 L11.1779002,14.4971772 L11.2991076,14.4694224 C11.3491682,14.4557375 11.4083624,14.437284 11.4751158,14.4130563 C11.769383,14.3062543 12.066676,14.1324596 12.3471758,13.8752234 C12.4371203,13.7927386 12.5240597,13.7026333 12.607654,13.6044743 C12.9760464,13.1719172 13.183059,12.6137678 13.1924195,12.030173 L13.1924195,12.030173 L13.3000132,5.32832551 C13.2997939,5.29016685 13.2826117,5.19085946 13.2386527,5.10425262 C13.1843838,4.99733326 13.1129774,4.94771265 12.9379578,4.94108739 C12.6814739,4.93138871 12.534132,5.11189595 12.4756792,5.39480062 L12.4768718,7.52734922 L11.2768718,7.52734922 L11.276,5.688 L11.2462883,5.6883208 L11.2339541,3.32771285 C11.2341,3.2560396 11.2209054,3.18817621 11.1957482,3.12818892 C11.0820579,2.85732094 10.9199288,2.71019133 10.6649031,2.71019133 C10.456829,2.71019133 10.3197487,2.87378067 10.2524297,3.11264939 L10.2530225,7.512783 L9.05302254,7.512783 L9.053,3.288 L9.01554331,3.28724203 L8.98800328,2.29901027 L8.9629175,2.22263368 C8.94515567,2.17417174 8.92167756,2.11937748 8.8924232,2.06330056 L8.8924232,2.06330056 L8.84420197,1.9788544 C8.72758855,1.79219249 8.59915015,1.70280728 8.42684173,1.70001476 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n\n<ng-template #adaptTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/Fit canvas</title>\n <g id=\"1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/Fit-canvas\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M14.9971494,10.4 L14.9971494,13.4020516 C14.9971494,14.2366152 14.3581879,14.9219414 13.542782,14.9955129 L13.3971494,15.0020516 L10.4,15.0020516 L10.4,13.8020516 L13.3971494,13.8020516 C13.590449,13.8020516 13.7517243,13.6649388 13.7890228,13.4826656 L13.7971494,13.4020516 L13.7971494,10.4 L14.9971494,10.4 Z M2.2,10.4 L2.2,13.3971494 C2.2,13.590449 2.3371128,13.7517243 2.51938605,13.7890228 L2.6,13.7971494 L5.60205161,13.7971494 L5.60205161,14.9971494 L2.6,14.9971494 C1.76543638,14.9971494 1.08011021,14.3581879 1.00653868,13.542782 L1,13.3971494 L1,10.4 L2.2,10.4 Z M10.5024511,4.9 C11.3861067,4.9 12.1024511,5.6163444 12.1024511,6.5 L12.1024511,6.5 L12.1024511,9.5 C12.1024511,10.3836556 11.3861067,11.1 10.5024511,11.1 L10.5024511,11.1 L5.50245112,11.1 C4.61879552,11.1 3.90245112,10.3836556 3.90245112,9.5 L3.90245112,9.5 L3.90245112,6.5 C3.90245112,5.6163444 4.61879552,4.9 5.50245112,4.9 L5.50245112,4.9 Z M10.5024511,6.1 L5.50245112,6.1 C5.28153722,6.1 5.10245112,6.2790861 5.10245112,6.5 L5.10245112,6.5 L5.10245112,9.5 C5.10245112,9.7209139 5.28153722,9.9 5.50245112,9.9 L5.50245112,9.9 L10.5024511,9.9 C10.723365,9.9 10.9024511,9.7209139 10.9024511,9.5 L10.9024511,9.5 L10.9024511,6.5 C10.9024511,6.2790861 10.723365,6.1 10.5024511,6.1 L10.5024511,6.1 Z M5.59714938,1 L5.59714938,2.2 L2.6,2.2 C2.40670034,2.2 2.24542508,2.3371128 2.20812658,2.51938605 L2.2,2.6 L2.2,5.60205161 L1,5.60205161 L1,2.6 C1,1.76543638 1.63896152,1.08011021 2.45436739,1.00653868 L2.6,1 L5.59714938,1 Z M13.3971494,1 L13.542782,1.00653868 C14.3581879,1.08011021 14.9971494,1.76543638 14.9971494,2.6 L14.9971494,2.6 L14.9971494,5.60205161 L13.7971494,5.60205161 L13.7971494,2.6 L13.7890228,2.51938605 C13.7517243,2.3371128 13.590449,2.2 13.3971494,2.2 L13.3971494,2.2 L10.4,2.2 L10.4,1 L13.3971494,1 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n<ng-template #zoomOutTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>action/zoom-out</title>\n <desc>Created with Sketch.</desc>\n <g id=\"action/zoom-out\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M6.85,2.73225886e-13 C10.6331505,2.73225886e-13 13.7,3.06684946 13.7,6.85 C13.7,8.54194045 13.0865836,10.0906098 12.0700142,11.2857448 L15.4201976,14.5717081 C15.6567367,14.8037768 15.6603607,15.1836585 15.4282919,15.4201976 C15.1962232,15.6567367 14.8163415,15.6603607 14.5798024,15.4282919 L14.5798024,15.4282919 L11.2163456,12.128262 C10.0309427,13.1099691 8.50937591,13.7 6.85,13.7 C3.06684946,13.7 4.58522109e-14,10.6331505 4.58522109e-14,6.85 C4.58522109e-14,3.06684946 3.06684946,2.73225886e-13 6.85,2.73225886e-13 Z M6.85,1.2 C3.72959116,1.2 1.2,3.72959116 1.2,6.85 C1.2,9.97040884 3.72959116,12.5 6.85,12.5 C8.31753357,12.5 9.65438791,11.9404957 10.6588859,11.0231643 C10.6855412,10.9625408 10.7245275,10.9050898 10.7743982,10.8542584 C10.8288931,10.7987137 10.8915387,10.7560124 10.9585649,10.7261903 C11.9144009,9.71595758 12.5,8.35136579 12.5,6.85 C12.5,3.72959116 9.97040884,1.2 6.85,1.2 Z M4.6,6.2 L9.12944565,6.2 C9.4608165,6.2 9.72944565,6.46862915 9.72944565,6.8 C9.72944565,7.09823376 9.51185604,7.34564675 9.22676876,7.39214701 L9.12944565,7.4 L4.6,7.4 C4.26862915,7.4 4,7.13137085 4,6.8 C4,6.50176624 4.21758961,6.25435325 4.50267688,6.20785299 L4.6,6.2 L9.12944565,6.2 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n\n<ng-template #zoomInTemplate\n ><svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>action/zoom-in</title>\n <desc>Created with Sketch.</desc>\n <g id=\"action/zoom-in\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M6.85,-1.81188398e-13 C10.6331505,-1.81188398e-13 13.7,3.06684946 13.7,6.85 C13.7,8.54194045 13.0865836,10.0906098 12.0700142,11.2857448 L15.4201976,14.5717081 C15.6567367,14.8037768 15.6603607,15.1836585 15.4282919,15.4201976 C15.1962232,15.6567367 14.8163415,15.6603607 14.5798024,15.4282919 L14.5798024,15.4282919 L11.2163456,12.128262 C10.0309427,13.1099691 8.50937591,13.7 6.85,13.7 C3.06684946,13.7 4.61852778e-14,10.6331505 4.61852778e-14,6.85 C4.61852778e-14,3.06684946 3.06684946,-1.81188398e-13 6.85,-1.81188398e-13 Z M6.85,1.2 C3.72959116,1.2 1.2,3.72959116 1.2,6.85 C1.2,9.97040884 3.72959116,12.5 6.85,12.5 C8.31753357,12.5 9.65438791,11.9404957 10.6588859,11.0231643 C10.6855412,10.9625408 10.7245275,10.9050898 10.7743982,10.8542584 C10.8288931,10.7987137 10.8915387,10.7560124 10.9585649,10.7261903 C11.9144009,9.71595758 12.5,8.35136579 12.5,6.85 C12.5,3.72959116 9.97040884,1.2 6.85,1.2 Z M6.86472282,3.93527718 C7.16295659,3.93527718 7.41036958,4.15286679 7.45686984,4.43795406 L7.46472282,4.53527718 L7.464,6.19927718 L9.12944565,6.2 C9.42767941,6.2 9.6750924,6.41758961 9.72159266,6.70267688 L9.72944565,6.8 C9.72944565,7.09823376 9.51185604,7.34564675 9.22676876,7.39214701 L9.12944565,7.4 L7.464,7.39927718 L7.46472282,9.06472282 C7.46472282,9.36295659 7.24713321,9.61036958 6.96204594,9.65686984 L6.86472282,9.66472282 C6.56648906,9.66472282 6.31907607,9.44713321 6.27257581,9.16204594 L6.26472282,9.06472282 L6.264,7.39927718 L4.6,7.4 C4.30176624,7.4 4.05435325,7.18241039 4.00785299,6.89732312 L4,6.8 C4,6.50176624 4.21758961,6.25435325 4.50267688,6.20785299 L4.6,6.2 L6.264,6.19927718 L6.26472282,4.53527718 C6.26472282,4.2701805 6.43664548,4.0452385 6.67507642,3.96586557 L6.76739971,3.94313016 L6.86472282,3.93527718 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n", directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1218
1311
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlaitToolbarComponent, decorators: [{
1219
1312
  type: Component,
1220
- args: [{ selector: 'plait-toolbar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"zoom-toolbar island plait-board-attached\">\n <a class=\"toolbar-item plait-action-icon\" [ngClass]=\"{ 'icon-active': cursorStatus === 'move' }\" (click)=\"dragMove()\">\n <ng-template [ngTemplateOutlet]=\"dragMoveTemplate\"></ng-template>\n </a>\n <div class=\"divider\"></div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"adapt()\">\n <ng-template [ngTemplateOutlet]=\"adaptTemplate\"></ng-template>\n </a>\n <div class=\"divider\"></div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"zoomOut()\">\n <ng-template [ngTemplateOutlet]=\"zoomOutTemplate\"></ng-template>\n </a>\n <div class=\"toolbar-item zoom-value\" (mousedown)=\"resetZoom()\">{{ viewZoom }}%</div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"zoomIn()\">\n <ng-template [ngTemplateOutlet]=\"zoomInTemplate\"></ng-template>\n </a>\n</div>\n\n<ng-template #dragMoveTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/hand</title>\n <g id=\"1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/hand\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M8.44583468,0.500225887 C9.07406934,0.510185679 9.54739531,0.839591366 9.86192311,1.34305279 C9.89696656,1.39914649 9.92878401,1.45492964 9.9576026,1.50991157 L9.9576026,1.50991157 L10.0210033,1.64201027 L10.061978,1.62350755 C10.1972891,1.56834247 10.3444107,1.53218464 10.5027907,1.51755353 L10.5027907,1.51755353 L10.6649031,1.51019133 C11.4883708,1.51019133 12.0208782,1.99343346 12.3023042,2.66393278 C12.3903714,2.87392911 12.4344191,3.10047818 12.4339446,3.3257952 L12.4339446,3.3257952 L12.4360033,3.80501027 L12.5160535,3.78341501 C12.6124478,3.76124046 12.7138812,3.74739854 12.820201,3.74250274 L12.820201,3.74250274 L12.9833264,3.74194533 C13.6121166,3.7657478 14.0645887,4.0801724 14.3087062,4.56112689 C14.4521117,4.8436609 14.4987984,5.11349437 14.4999262,5.33449618 L14.4999262,5.33449618 L14.3922653,12.049414 C14.3784752,12.909177 14.0717787,13.7360948 13.5212406,14.3825228 C13.4055676,14.5183496 13.2843697,14.643961 13.1582361,14.7596335 C12.4634771,15.3967716 11.755103,15.6538706 11.1897396,15.7000055 L11.1897396,15.7000055 L7.4723083,15.6798158 C7.14276373,15.634268 6.81580098,15.5154267 6.49455235,15.3472501 C6.25643701,15.2225944 6.06881706,15.0975452 5.88705731,14.9494308 L5.88705731,14.9494308 L2.55198782,11.500873 C2.39559475,11.3769079 2.17626793,11.1748532 1.9548636,10.9139403 C1.57867502,10.4706225 1.33501976,10.0139923 1.30330257,9.52833025 C1.28093191,9.18578476 1.37200912,8.85641102 1.5826788,8.56872564 C1.82538833,8.23725279 2.12881965,8.02107162 2.47470569,7.92957033 C2.95807982,7.80169771 3.42705723,7.92468989 3.86509644,8.18731167 C4.04431391,8.29475961 4.1816109,8.40304483 4.26225571,8.47866867 L4.26225571,8.47866867 L4.61400328,8.79701027 L4.57247249,3.59275349 L4.57628524,3.46204923 C4.5897691,3.23444442 4.64087578,2.95701848 4.75937106,2.66961597 C5.01017272,2.06131302 5.49670227,1.64692543 6.21363856,1.60818786 C6.44223508,1.59583681 6.65042099,1.62176802 6.83696985,1.68057551 L6.83696985,1.68057551 L6.86400328,1.69001027 C6.88501862,1.63593052 6.90764242,1.58175442 6.9331867,1.52672633 L6.9331867,1.52672633 L7.01883595,1.35955614 C7.31549194,0.832047939 7.79476072,0.48993549 8.44583468,0.500225887 Z M8.42684173,1.70001476 C8.26825412,1.69756905 8.16339456,1.77242008 8.06478367,1.94776814 C8.03967773,1.99241107 8.01831703,2.03811495 8.00083464,2.07855067 L8.00083464,2.07855067 L7.94879157,2.2035905 L7.94354455,2.20731401 L7.943,3.161 L7.97170661,3.16123746 L7.97170661,7.60991883 L6.77170661,7.60991883 L6.771,3.338 L6.74362358,3.33880359 C6.74284189,3.29064626 6.73014163,3.20282206 6.7002616,3.11094408 L6.66446012,3.01903385 C6.58982025,2.85766739 6.49843292,2.79455071 6.27838133,2.80644008 C6.07001018,2.81769881 5.95642108,2.91444507 5.86877664,3.12702089 C5.79792279,3.29887224 5.77228127,3.48655908 5.77246879,3.58977183 L5.77246879,3.58977183 L5.83613619,11.5252021 L3.41863956,9.33477657 L3.31637296,9.25979571 L3.24805011,9.21651224 C3.06096922,9.10434987 2.89279975,9.06024641 2.78159879,9.0896637 C2.71007735,9.10858411 2.63607367,9.1613084 2.55086305,9.27768211 C2.51020424,9.33320478 2.49638061,9.38319687 2.50075171,9.4501283 C2.51206889,9.62341997 2.64503022,9.87260054 2.86983366,10.1375191 C3.03268834,10.3294345 3.19762053,10.4813781 3.35554956,10.6131022 L3.35554956,10.6131022 L6.68454317,14.0569073 C6.71106575,14.0773808 6.74806086,14.1037158 6.79369091,14.1335929 L6.79369091,14.1335929 L6.95464838,14.2315311 L7.05111031,14.2841211 C7.25978123,14.3933622 7.46253523,14.4670573 7.55685495,14.4854708 L7.55685495,14.4854708 L11.1407985,14.5022108 C11.1503576,14.5013899 11.1627905,14.4997539 11.1779002,14.4971772 L11.1779002,14.4971772 L11.2991076,14.4694224 C11.3491682,14.4557375 11.4083624,14.437284 11.4751158,14.4130563 C11.769383,14.3062543 12.066676,14.1324596 12.3471758,13.8752234 C12.4371203,13.7927386 12.5240597,13.7026333 12.607654,13.6044743 C12.9760464,13.1719172 13.183059,12.6137678 13.1924195,12.030173 L13.1924195,12.030173 L13.3000132,5.32832551 C13.2997939,5.29016685 13.2826117,5.19085946 13.2386527,5.10425262 C13.1843838,4.99733326 13.1129774,4.94771265 12.9379578,4.94108739 C12.6814739,4.93138871 12.534132,5.11189595 12.4756792,5.39480062 L12.4768718,7.52734922 L11.2768718,7.52734922 L11.276,5.688 L11.2462883,5.6883208 L11.2339541,3.32771285 C11.2341,3.2560396 11.2209054,3.18817621 11.1957482,3.12818892 C11.0820579,2.85732094 10.9199288,2.71019133 10.6649031,2.71019133 C10.456829,2.71019133 10.3197487,2.87378067 10.2524297,3.11264939 L10.2530225,7.512783 L9.05302254,7.512783 L9.053,3.288 L9.01554331,3.28724203 L8.98800328,2.29901027 L8.9629175,2.22263368 C8.94515567,2.17417174 8.92167756,2.11937748 8.8924232,2.06330056 L8.8924232,2.06330056 L8.84420197,1.9788544 C8.72758855,1.79219249 8.59915015,1.70280728 8.42684173,1.70001476 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n\n<ng-template #adaptTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/Fit canvas</title>\n <g id=\"1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/Fit-canvas\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M14.9971494,10.4 L14.9971494,13.4020516 C14.9971494,14.2366152 14.3581879,14.9219414 13.542782,14.9955129 L13.3971494,15.0020516 L10.4,15.0020516 L10.4,13.8020516 L13.3971494,13.8020516 C13.590449,13.8020516 13.7517243,13.6649388 13.7890228,13.4826656 L13.7971494,13.4020516 L13.7971494,10.4 L14.9971494,10.4 Z M2.2,10.4 L2.2,13.3971494 C2.2,13.590449 2.3371128,13.7517243 2.51938605,13.7890228 L2.6,13.7971494 L5.60205161,13.7971494 L5.60205161,14.9971494 L2.6,14.9971494 C1.76543638,14.9971494 1.08011021,14.3581879 1.00653868,13.542782 L1,13.3971494 L1,10.4 L2.2,10.4 Z M10.5024511,4.9 C11.3861067,4.9 12.1024511,5.6163444 12.1024511,6.5 L12.1024511,6.5 L12.1024511,9.5 C12.1024511,10.3836556 11.3861067,11.1 10.5024511,11.1 L10.5024511,11.1 L5.50245112,11.1 C4.61879552,11.1 3.90245112,10.3836556 3.90245112,9.5 L3.90245112,9.5 L3.90245112,6.5 C3.90245112,5.6163444 4.61879552,4.9 5.50245112,4.9 L5.50245112,4.9 Z M10.5024511,6.1 L5.50245112,6.1 C5.28153722,6.1 5.10245112,6.2790861 5.10245112,6.5 L5.10245112,6.5 L5.10245112,9.5 C5.10245112,9.7209139 5.28153722,9.9 5.50245112,9.9 L5.50245112,9.9 L10.5024511,9.9 C10.723365,9.9 10.9024511,9.7209139 10.9024511,9.5 L10.9024511,9.5 L10.9024511,6.5 C10.9024511,6.2790861 10.723365,6.1 10.5024511,6.1 L10.5024511,6.1 Z M5.59714938,1 L5.59714938,2.2 L2.6,2.2 C2.40670034,2.2 2.24542508,2.3371128 2.20812658,2.51938605 L2.2,2.6 L2.2,5.60205161 L1,5.60205161 L1,2.6 C1,1.76543638 1.63896152,1.08011021 2.45436739,1.00653868 L2.6,1 L5.59714938,1 Z M13.3971494,1 L13.542782,1.00653868 C14.3581879,1.08011021 14.9971494,1.76543638 14.9971494,2.6 L14.9971494,2.6 L14.9971494,5.60205161 L13.7971494,5.60205161 L13.7971494,2.6 L13.7890228,2.51938605 C13.7517243,2.3371128 13.590449,2.2 13.3971494,2.2 L13.3971494,2.2 L10.4,2.2 L10.4,1 L13.3971494,1 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n<ng-template #zoomOutTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>action/zoom-out</title>\n <desc>Created with Sketch.</desc>\n <g id=\"action/zoom-out\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M6.85,2.73225886e-13 C10.6331505,2.73225886e-13 13.7,3.06684946 13.7,6.85 C13.7,8.54194045 13.0865836,10.0906098 12.0700142,11.2857448 L15.4201976,14.5717081 C15.6567367,14.8037768 15.6603607,15.1836585 15.4282919,15.4201976 C15.1962232,15.6567367 14.8163415,15.6603607 14.5798024,15.4282919 L14.5798024,15.4282919 L11.2163456,12.128262 C10.0309427,13.1099691 8.50937591,13.7 6.85,13.7 C3.06684946,13.7 4.58522109e-14,10.6331505 4.58522109e-14,6.85 C4.58522109e-14,3.06684946 3.06684946,2.73225886e-13 6.85,2.73225886e-13 Z M6.85,1.2 C3.72959116,1.2 1.2,3.72959116 1.2,6.85 C1.2,9.97040884 3.72959116,12.5 6.85,12.5 C8.31753357,12.5 9.65438791,11.9404957 10.6588859,11.0231643 C10.6855412,10.9625408 10.7245275,10.9050898 10.7743982,10.8542584 C10.8288931,10.7987137 10.8915387,10.7560124 10.9585649,10.7261903 C11.9144009,9.71595758 12.5,8.35136579 12.5,6.85 C12.5,3.72959116 9.97040884,1.2 6.85,1.2 Z M4.6,6.2 L9.12944565,6.2 C9.4608165,6.2 9.72944565,6.46862915 9.72944565,6.8 C9.72944565,7.09823376 9.51185604,7.34564675 9.22676876,7.39214701 L9.12944565,7.4 L4.6,7.4 C4.26862915,7.4 4,7.13137085 4,6.8 C4,6.50176624 4.21758961,6.25435325 4.50267688,6.20785299 L4.6,6.2 L9.12944565,6.2 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n\n<ng-template #zoomInTemplate\n ><svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>action/zoom-in</title>\n <desc>Created with Sketch.</desc>\n <g id=\"action/zoom-in\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M6.85,-1.81188398e-13 C10.6331505,-1.81188398e-13 13.7,3.06684946 13.7,6.85 C13.7,8.54194045 13.0865836,10.0906098 12.0700142,11.2857448 L15.4201976,14.5717081 C15.6567367,14.8037768 15.6603607,15.1836585 15.4282919,15.4201976 C15.1962232,15.6567367 14.8163415,15.6603607 14.5798024,15.4282919 L14.5798024,15.4282919 L11.2163456,12.128262 C10.0309427,13.1099691 8.50937591,13.7 6.85,13.7 C3.06684946,13.7 4.61852778e-14,10.6331505 4.61852778e-14,6.85 C4.61852778e-14,3.06684946 3.06684946,-1.81188398e-13 6.85,-1.81188398e-13 Z M6.85,1.2 C3.72959116,1.2 1.2,3.72959116 1.2,6.85 C1.2,9.97040884 3.72959116,12.5 6.85,12.5 C8.31753357,12.5 9.65438791,11.9404957 10.6588859,11.0231643 C10.6855412,10.9625408 10.7245275,10.9050898 10.7743982,10.8542584 C10.8288931,10.7987137 10.8915387,10.7560124 10.9585649,10.7261903 C11.9144009,9.71595758 12.5,8.35136579 12.5,6.85 C12.5,3.72959116 9.97040884,1.2 6.85,1.2 Z M6.86472282,3.93527718 C7.16295659,3.93527718 7.41036958,4.15286679 7.45686984,4.43795406 L7.46472282,4.53527718 L7.464,6.19927718 L9.12944565,6.2 C9.42767941,6.2 9.6750924,6.41758961 9.72159266,6.70267688 L9.72944565,6.8 C9.72944565,7.09823376 9.51185604,7.34564675 9.22676876,7.39214701 L9.12944565,7.4 L7.464,7.39927718 L7.46472282,9.06472282 C7.46472282,9.36295659 7.24713321,9.61036958 6.96204594,9.65686984 L6.86472282,9.66472282 C6.56648906,9.66472282 6.31907607,9.44713321 6.27257581,9.16204594 L6.26472282,9.06472282 L6.264,7.39927718 L4.6,7.4 C4.30176624,7.4 4.05435325,7.18241039 4.00785299,6.89732312 L4,6.8 C4,6.50176624 4.21758961,6.25435325 4.50267688,6.20785299 L4.6,6.2 L6.264,6.19927718 L6.26472282,4.53527718 C6.26472282,4.2701805 6.43664548,4.0452385 6.67507642,3.96586557 L6.76739971,3.94313016 L6.86472282,3.93527718 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n" }]
1313
+ args: [{ selector: 'plait-toolbar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"zoom-toolbar island plait-board-attached\">\n <a class=\"toolbar-item plait-action-icon\" [ngClass]=\"{ 'icon-active': pointerType === PlaitPointerType.hand}\" (click)=\"activeHand()\">\n <ng-template [ngTemplateOutlet]=\"dragMoveTemplate\"></ng-template>\n </a>\n <div class=\"divider\"></div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"adapt()\">\n <ng-template [ngTemplateOutlet]=\"adaptTemplate\"></ng-template>\n </a>\n <div class=\"divider\"></div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"zoomOut()\">\n <ng-template [ngTemplateOutlet]=\"zoomOutTemplate\"></ng-template>\n </a>\n <div class=\"toolbar-item zoom-value\" (mousedown)=\"resetZoom()\">{{ zoom }}%</div>\n <a class=\"toolbar-item plait-action-icon\" (mousedown)=\"zoomIn()\">\n <ng-template [ngTemplateOutlet]=\"zoomInTemplate\"></ng-template>\n </a>\n</div>\n\n<ng-template #dragMoveTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/hand</title>\n <g id=\"1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/hand\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M8.44583468,0.500225887 C9.07406934,0.510185679 9.54739531,0.839591366 9.86192311,1.34305279 C9.89696656,1.39914649 9.92878401,1.45492964 9.9576026,1.50991157 L9.9576026,1.50991157 L10.0210033,1.64201027 L10.061978,1.62350755 C10.1972891,1.56834247 10.3444107,1.53218464 10.5027907,1.51755353 L10.5027907,1.51755353 L10.6649031,1.51019133 C11.4883708,1.51019133 12.0208782,1.99343346 12.3023042,2.66393278 C12.3903714,2.87392911 12.4344191,3.10047818 12.4339446,3.3257952 L12.4339446,3.3257952 L12.4360033,3.80501027 L12.5160535,3.78341501 C12.6124478,3.76124046 12.7138812,3.74739854 12.820201,3.74250274 L12.820201,3.74250274 L12.9833264,3.74194533 C13.6121166,3.7657478 14.0645887,4.0801724 14.3087062,4.56112689 C14.4521117,4.8436609 14.4987984,5.11349437 14.4999262,5.33449618 L14.4999262,5.33449618 L14.3922653,12.049414 C14.3784752,12.909177 14.0717787,13.7360948 13.5212406,14.3825228 C13.4055676,14.5183496 13.2843697,14.643961 13.1582361,14.7596335 C12.4634771,15.3967716 11.755103,15.6538706 11.1897396,15.7000055 L11.1897396,15.7000055 L7.4723083,15.6798158 C7.14276373,15.634268 6.81580098,15.5154267 6.49455235,15.3472501 C6.25643701,15.2225944 6.06881706,15.0975452 5.88705731,14.9494308 L5.88705731,14.9494308 L2.55198782,11.500873 C2.39559475,11.3769079 2.17626793,11.1748532 1.9548636,10.9139403 C1.57867502,10.4706225 1.33501976,10.0139923 1.30330257,9.52833025 C1.28093191,9.18578476 1.37200912,8.85641102 1.5826788,8.56872564 C1.82538833,8.23725279 2.12881965,8.02107162 2.47470569,7.92957033 C2.95807982,7.80169771 3.42705723,7.92468989 3.86509644,8.18731167 C4.04431391,8.29475961 4.1816109,8.40304483 4.26225571,8.47866867 L4.26225571,8.47866867 L4.61400328,8.79701027 L4.57247249,3.59275349 L4.57628524,3.46204923 C4.5897691,3.23444442 4.64087578,2.95701848 4.75937106,2.66961597 C5.01017272,2.06131302 5.49670227,1.64692543 6.21363856,1.60818786 C6.44223508,1.59583681 6.65042099,1.62176802 6.83696985,1.68057551 L6.83696985,1.68057551 L6.86400328,1.69001027 C6.88501862,1.63593052 6.90764242,1.58175442 6.9331867,1.52672633 L6.9331867,1.52672633 L7.01883595,1.35955614 C7.31549194,0.832047939 7.79476072,0.48993549 8.44583468,0.500225887 Z M8.42684173,1.70001476 C8.26825412,1.69756905 8.16339456,1.77242008 8.06478367,1.94776814 C8.03967773,1.99241107 8.01831703,2.03811495 8.00083464,2.07855067 L8.00083464,2.07855067 L7.94879157,2.2035905 L7.94354455,2.20731401 L7.943,3.161 L7.97170661,3.16123746 L7.97170661,7.60991883 L6.77170661,7.60991883 L6.771,3.338 L6.74362358,3.33880359 C6.74284189,3.29064626 6.73014163,3.20282206 6.7002616,3.11094408 L6.66446012,3.01903385 C6.58982025,2.85766739 6.49843292,2.79455071 6.27838133,2.80644008 C6.07001018,2.81769881 5.95642108,2.91444507 5.86877664,3.12702089 C5.79792279,3.29887224 5.77228127,3.48655908 5.77246879,3.58977183 L5.77246879,3.58977183 L5.83613619,11.5252021 L3.41863956,9.33477657 L3.31637296,9.25979571 L3.24805011,9.21651224 C3.06096922,9.10434987 2.89279975,9.06024641 2.78159879,9.0896637 C2.71007735,9.10858411 2.63607367,9.1613084 2.55086305,9.27768211 C2.51020424,9.33320478 2.49638061,9.38319687 2.50075171,9.4501283 C2.51206889,9.62341997 2.64503022,9.87260054 2.86983366,10.1375191 C3.03268834,10.3294345 3.19762053,10.4813781 3.35554956,10.6131022 L3.35554956,10.6131022 L6.68454317,14.0569073 C6.71106575,14.0773808 6.74806086,14.1037158 6.79369091,14.1335929 L6.79369091,14.1335929 L6.95464838,14.2315311 L7.05111031,14.2841211 C7.25978123,14.3933622 7.46253523,14.4670573 7.55685495,14.4854708 L7.55685495,14.4854708 L11.1407985,14.5022108 C11.1503576,14.5013899 11.1627905,14.4997539 11.1779002,14.4971772 L11.1779002,14.4971772 L11.2991076,14.4694224 C11.3491682,14.4557375 11.4083624,14.437284 11.4751158,14.4130563 C11.769383,14.3062543 12.066676,14.1324596 12.3471758,13.8752234 C12.4371203,13.7927386 12.5240597,13.7026333 12.607654,13.6044743 C12.9760464,13.1719172 13.183059,12.6137678 13.1924195,12.030173 L13.1924195,12.030173 L13.3000132,5.32832551 C13.2997939,5.29016685 13.2826117,5.19085946 13.2386527,5.10425262 C13.1843838,4.99733326 13.1129774,4.94771265 12.9379578,4.94108739 C12.6814739,4.93138871 12.534132,5.11189595 12.4756792,5.39480062 L12.4768718,7.52734922 L11.2768718,7.52734922 L11.276,5.688 L11.2462883,5.6883208 L11.2339541,3.32771285 C11.2341,3.2560396 11.2209054,3.18817621 11.1957482,3.12818892 C11.0820579,2.85732094 10.9199288,2.71019133 10.6649031,2.71019133 C10.456829,2.71019133 10.3197487,2.87378067 10.2524297,3.11264939 L10.2530225,7.512783 L9.05302254,7.512783 L9.053,3.288 L9.01554331,3.28724203 L8.98800328,2.29901027 L8.9629175,2.22263368 C8.94515567,2.17417174 8.92167756,2.11937748 8.8924232,2.06330056 L8.8924232,2.06330056 L8.84420197,1.9788544 C8.72758855,1.79219249 8.59915015,1.70280728 8.42684173,1.70001476 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n\n<ng-template #adaptTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/Fit canvas</title>\n <g id=\"1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/Fit-canvas\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M14.9971494,10.4 L14.9971494,13.4020516 C14.9971494,14.2366152 14.3581879,14.9219414 13.542782,14.9955129 L13.3971494,15.0020516 L10.4,15.0020516 L10.4,13.8020516 L13.3971494,13.8020516 C13.590449,13.8020516 13.7517243,13.6649388 13.7890228,13.4826656 L13.7971494,13.4020516 L13.7971494,10.4 L14.9971494,10.4 Z M2.2,10.4 L2.2,13.3971494 C2.2,13.590449 2.3371128,13.7517243 2.51938605,13.7890228 L2.6,13.7971494 L5.60205161,13.7971494 L5.60205161,14.9971494 L2.6,14.9971494 C1.76543638,14.9971494 1.08011021,14.3581879 1.00653868,13.542782 L1,13.3971494 L1,10.4 L2.2,10.4 Z M10.5024511,4.9 C11.3861067,4.9 12.1024511,5.6163444 12.1024511,6.5 L12.1024511,6.5 L12.1024511,9.5 C12.1024511,10.3836556 11.3861067,11.1 10.5024511,11.1 L10.5024511,11.1 L5.50245112,11.1 C4.61879552,11.1 3.90245112,10.3836556 3.90245112,9.5 L3.90245112,9.5 L3.90245112,6.5 C3.90245112,5.6163444 4.61879552,4.9 5.50245112,4.9 L5.50245112,4.9 Z M10.5024511,6.1 L5.50245112,6.1 C5.28153722,6.1 5.10245112,6.2790861 5.10245112,6.5 L5.10245112,6.5 L5.10245112,9.5 C5.10245112,9.7209139 5.28153722,9.9 5.50245112,9.9 L5.50245112,9.9 L10.5024511,9.9 C10.723365,9.9 10.9024511,9.7209139 10.9024511,9.5 L10.9024511,9.5 L10.9024511,6.5 C10.9024511,6.2790861 10.723365,6.1 10.5024511,6.1 L10.5024511,6.1 Z M5.59714938,1 L5.59714938,2.2 L2.6,2.2 C2.40670034,2.2 2.24542508,2.3371128 2.20812658,2.51938605 L2.2,2.6 L2.2,5.60205161 L1,5.60205161 L1,2.6 C1,1.76543638 1.63896152,1.08011021 2.45436739,1.00653868 L2.6,1 L5.59714938,1 Z M13.3971494,1 L13.542782,1.00653868 C14.3581879,1.08011021 14.9971494,1.76543638 14.9971494,2.6 L14.9971494,2.6 L14.9971494,5.60205161 L13.7971494,5.60205161 L13.7971494,2.6 L13.7890228,2.51938605 C13.7517243,2.3371128 13.590449,2.2 13.3971494,2.2 L13.3971494,2.2 L10.4,2.2 L10.4,1 L13.3971494,1 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n<ng-template #zoomOutTemplate>\n <svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>action/zoom-out</title>\n <desc>Created with Sketch.</desc>\n <g id=\"action/zoom-out\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M6.85,2.73225886e-13 C10.6331505,2.73225886e-13 13.7,3.06684946 13.7,6.85 C13.7,8.54194045 13.0865836,10.0906098 12.0700142,11.2857448 L15.4201976,14.5717081 C15.6567367,14.8037768 15.6603607,15.1836585 15.4282919,15.4201976 C15.1962232,15.6567367 14.8163415,15.6603607 14.5798024,15.4282919 L14.5798024,15.4282919 L11.2163456,12.128262 C10.0309427,13.1099691 8.50937591,13.7 6.85,13.7 C3.06684946,13.7 4.58522109e-14,10.6331505 4.58522109e-14,6.85 C4.58522109e-14,3.06684946 3.06684946,2.73225886e-13 6.85,2.73225886e-13 Z M6.85,1.2 C3.72959116,1.2 1.2,3.72959116 1.2,6.85 C1.2,9.97040884 3.72959116,12.5 6.85,12.5 C8.31753357,12.5 9.65438791,11.9404957 10.6588859,11.0231643 C10.6855412,10.9625408 10.7245275,10.9050898 10.7743982,10.8542584 C10.8288931,10.7987137 10.8915387,10.7560124 10.9585649,10.7261903 C11.9144009,9.71595758 12.5,8.35136579 12.5,6.85 C12.5,3.72959116 9.97040884,1.2 6.85,1.2 Z M4.6,6.2 L9.12944565,6.2 C9.4608165,6.2 9.72944565,6.46862915 9.72944565,6.8 C9.72944565,7.09823376 9.51185604,7.34564675 9.22676876,7.39214701 L9.12944565,7.4 L4.6,7.4 C4.26862915,7.4 4,7.13137085 4,6.8 C4,6.50176624 4.21758961,6.25435325 4.50267688,6.20785299 L4.6,6.2 L9.12944565,6.2 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n\n<ng-template #zoomInTemplate\n ><svg\n width=\"16px\"\n height=\"16px\"\n viewBox=\"0 0 16 16\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n >\n <title>action/zoom-in</title>\n <desc>Created with Sketch.</desc>\n <g id=\"action/zoom-in\" stroke=\"none\" stroke-width=\"1\" fill-rule=\"evenodd\">\n <path\n d=\"M6.85,-1.81188398e-13 C10.6331505,-1.81188398e-13 13.7,3.06684946 13.7,6.85 C13.7,8.54194045 13.0865836,10.0906098 12.0700142,11.2857448 L15.4201976,14.5717081 C15.6567367,14.8037768 15.6603607,15.1836585 15.4282919,15.4201976 C15.1962232,15.6567367 14.8163415,15.6603607 14.5798024,15.4282919 L14.5798024,15.4282919 L11.2163456,12.128262 C10.0309427,13.1099691 8.50937591,13.7 6.85,13.7 C3.06684946,13.7 4.61852778e-14,10.6331505 4.61852778e-14,6.85 C4.61852778e-14,3.06684946 3.06684946,-1.81188398e-13 6.85,-1.81188398e-13 Z M6.85,1.2 C3.72959116,1.2 1.2,3.72959116 1.2,6.85 C1.2,9.97040884 3.72959116,12.5 6.85,12.5 C8.31753357,12.5 9.65438791,11.9404957 10.6588859,11.0231643 C10.6855412,10.9625408 10.7245275,10.9050898 10.7743982,10.8542584 C10.8288931,10.7987137 10.8915387,10.7560124 10.9585649,10.7261903 C11.9144009,9.71595758 12.5,8.35136579 12.5,6.85 C12.5,3.72959116 9.97040884,1.2 6.85,1.2 Z M6.86472282,3.93527718 C7.16295659,3.93527718 7.41036958,4.15286679 7.45686984,4.43795406 L7.46472282,4.53527718 L7.464,6.19927718 L9.12944565,6.2 C9.42767941,6.2 9.6750924,6.41758961 9.72159266,6.70267688 L9.72944565,6.8 C9.72944565,7.09823376 9.51185604,7.34564675 9.22676876,7.39214701 L9.12944565,7.4 L7.464,7.39927718 L7.46472282,9.06472282 C7.46472282,9.36295659 7.24713321,9.61036958 6.96204594,9.65686984 L6.86472282,9.66472282 C6.56648906,9.66472282 6.31907607,9.44713321 6.27257581,9.16204594 L6.26472282,9.06472282 L6.264,7.39927718 L4.6,7.4 C4.30176624,7.4 4.05435325,7.18241039 4.00785299,6.89732312 L4,6.8 C4,6.50176624 4.21758961,6.25435325 4.50267688,6.20785299 L4.6,6.2 L6.264,6.19927718 L6.26472282,4.53527718 C6.26472282,4.2701805 6.43664548,4.0452385 6.67507642,3.96586557 L6.76739971,3.94313016 L6.86472282,3.93527718 Z\"\n id=\"\u5F62\u72B6\u7ED3\u5408\"\n fill-rule=\"nonzero\"\n ></path>\n </g>\n </svg>\n</ng-template>\n" }]
1221
1314
  }], propDecorators: { hostClass: [{
1222
1315
  type: HostBinding,
1223
1316
  args: ['class']
1224
- }], cursorStatus: [{
1225
- type: Input
1226
- }], viewZoom: [{
1317
+ }], board: [{
1227
1318
  type: Input
1228
- }], moveHandle: [{
1229
- type: Output
1230
1319
  }], adaptHandle: [{
1231
1320
  type: Output
1232
1321
  }], zoomInHandle: [{
@@ -1244,13 +1333,12 @@ class PlaitBoardComponent {
1244
1333
  this.elementRef = elementRef;
1245
1334
  this.hasInitialized = false;
1246
1335
  this.destroy$ = new Subject();
1247
- this.autoFitPadding = 8;
1336
+ this.viewportState = {
1337
+ zoom: 1,
1338
+ autoFitPadding: 8,
1339
+ scrollBarWidth: SCROLL_BAR_WIDTH
1340
+ };
1248
1341
  this.isMoving = false;
1249
- this.zoom = 1;
1250
- this.viewportCanvasBox = {};
1251
- this.focusPoint = [0, 0];
1252
- this.width = 0;
1253
- this.height = 0;
1254
1342
  this.plaitValue = [];
1255
1343
  this.plaitPlugins = [];
1256
1344
  this.plaitChange = new EventEmitter();
@@ -1259,9 +1347,6 @@ class PlaitBoardComponent {
1259
1347
  return index;
1260
1348
  };
1261
1349
  }
1262
- get isMoveMode() {
1263
- return this.board.cursor === BaseCursorStatus.move;
1264
- }
1265
1350
  get host() {
1266
1351
  return this.svg.nativeElement;
1267
1352
  }
@@ -1269,19 +1354,21 @@ class PlaitBoardComponent {
1269
1354
  return this.board?.selection;
1270
1355
  }
1271
1356
  get hostClass() {
1272
- return `plait-board-container ${this.board.cursor}`;
1357
+ return `plait-board-container ${this.board.pointer}`;
1273
1358
  }
1274
1359
  get readonly() {
1275
1360
  return this.board.options.readonly;
1276
1361
  }
1277
1362
  get moving() {
1278
- return this.board.cursor === BaseCursorStatus.move && this.isMoving;
1363
+ return this.board.pointer === PlaitPointerType.hand && this.isMoving;
1279
1364
  }
1280
1365
  get focused() {
1281
1366
  return this.isFocused;
1282
1367
  }
1283
1368
  ngOnInit() {
1284
- const roughSVG = rough.svg(this.host, { options: { roughness: 0, strokeWidth: 1 } });
1369
+ const roughSVG = rough.svg(this.host, {
1370
+ options: { roughness: 0, strokeWidth: 1 }
1371
+ });
1285
1372
  HOST_TO_ROUGH_SVG.set(this.host, roughSVG);
1286
1373
  this.initializePlugins();
1287
1374
  this.initializeEvents();
@@ -1294,9 +1381,6 @@ class PlaitBoardComponent {
1294
1381
  viewport: this.board.viewport,
1295
1382
  selection: this.board.selection
1296
1383
  };
1297
- if (this.board.operations.length > 0) {
1298
- this.updateViewport();
1299
- }
1300
1384
  this.plaitChange.emit(changeEvent);
1301
1385
  });
1302
1386
  this.hasInitialized = true;
@@ -1315,12 +1399,12 @@ class PlaitBoardComponent {
1315
1399
  }
1316
1400
  ngAfterViewInit() {
1317
1401
  this.plaitBoardInitialized.emit(this.board);
1318
- this.initContainerSize();
1319
- this.setViewport(1);
1320
- this.plaitViewport ? this.initCanvas(this.plaitViewport) : this.focusGraphicCenter();
1402
+ this.initViewportContainer();
1403
+ this.calcViewBox(this.viewportState.zoom);
1404
+ this.initViewport();
1321
1405
  }
1322
1406
  initializePlugins() {
1323
- let board = withMove(withHistory(withSelection(withBoard(createBoard(this.host, this.plaitValue, this.plaitOptions)))));
1407
+ let board = withHandPointer(withHistory(withSelection(withBoard(createBoard(this.host, this.plaitValue, this.plaitOptions)))));
1324
1408
  this.plaitPlugins.forEach(plugin => {
1325
1409
  board = plugin(board);
1326
1410
  });
@@ -1328,6 +1412,11 @@ class PlaitBoardComponent {
1328
1412
  if (this.plaitViewport) {
1329
1413
  this.board.viewport = this.plaitViewport;
1330
1414
  }
1415
+ const scrollBarWidth = this.plaitOptions?.hideScrollbar ? SCROLL_BAR_WIDTH : 0;
1416
+ this.updateViewportState({
1417
+ scrollBarWidth,
1418
+ zoom: this.board.viewport?.zoom ?? 1
1419
+ });
1331
1420
  }
1332
1421
  initializeEvents() {
1333
1422
  fromEvent(this.host, 'mousedown')
@@ -1388,245 +1477,207 @@ class PlaitBoardComponent {
1388
1477
  this.board?.setFragment(event.clipboardData);
1389
1478
  this.board?.deleteFragment(event.clipboardData);
1390
1479
  });
1391
- fromEvent(this.contentContainer.nativeElement, 'mousemove')
1392
- .pipe(takeUntil(this.destroy$), filter(() => {
1393
- return !!this.isFocused;
1394
- }))
1395
- .subscribe((e) => {
1396
- this.focusPoint = [e.clientX, e.clientY];
1397
- });
1398
- fromEvent(this.contentContainer.nativeElement, 'mouseleave')
1399
- .pipe(takeUntil(this.destroy$), filter(() => {
1400
- return !!this.isFocused;
1401
- }))
1402
- .subscribe((e) => {
1403
- this.resetFocusPoint();
1404
- });
1405
- fromEvent(this.contentContainer.nativeElement, 'scroll')
1480
+ fromEvent(this.viewportContainer.nativeElement, 'scroll')
1406
1481
  .pipe(takeUntil(this.destroy$), filter(() => {
1407
1482
  return !!this.isFocused;
1408
1483
  }))
1409
1484
  .subscribe((event) => {
1410
- const scrollLeft = event.target.scrollLeft;
1411
- const scrollTop = event.target.scrollTop;
1412
- (Math.abs(this.scrollLeft - scrollLeft) <= 1 && Math.abs(this.scrollTop - scrollTop) <= 1) ||
1413
- this.setScroll(scrollLeft, scrollTop);
1485
+ const { scrollLeft, scrollTop } = event.target;
1486
+ const left = this.viewportState.scrollLeft;
1487
+ const top = this.viewportState.scrollTop;
1488
+ if (Math.abs(left - scrollLeft) >= 1 || Math.abs(top - scrollTop) >= 1) {
1489
+ this.setScrollLeft(scrollLeft);
1490
+ this.setScrollTop(scrollTop);
1491
+ this.setViewport();
1492
+ }
1414
1493
  });
1415
1494
  this.resizeElement();
1416
1495
  }
1417
1496
  resizeElement() {
1418
1497
  this.resizeObserver = new ResizeObserver(entries => {
1419
1498
  for (let entry of entries) {
1420
- const { width, height } = entry.contentRect;
1421
- const hideScrollbar = this.board.options.hideScrollbar;
1422
- const scrollBarWidth = hideScrollbar ? SCROLL_BAR_WIDTH : 0;
1423
- this.width = width + scrollBarWidth;
1424
- this.height = height + scrollBarWidth;
1425
- this.changeSize();
1499
+ this.initViewportContainer();
1500
+ this.calcViewBox(this.board.viewport.zoom);
1501
+ this.updateViewBoxStyles();
1502
+ this.updateViewportScrolling();
1503
+ this.setViewport();
1426
1504
  }
1427
1505
  });
1428
1506
  this.resizeObserver.observe(this.elementRef.nativeElement);
1429
1507
  }
1430
- initContainerSize() {
1431
- const clientBox = getViewportClientBox(this.board);
1432
- this.width = clientBox.width;
1433
- this.height = clientBox.height;
1434
- this.resizeViewport();
1435
- }
1436
- resizeViewport() {
1437
- const container = this.elementRef.nativeElement?.parentElement;
1438
- const containerRect = container?.getBoundingClientRect();
1439
- const hideScrollbar = this.board.options.hideScrollbar;
1440
- const scrollBarWidth = hideScrollbar ? SCROLL_BAR_WIDTH : 0;
1441
- const width = `${containerRect.width + scrollBarWidth}px`;
1442
- const height = `${containerRect.height + scrollBarWidth}px`;
1443
- this.renderer2.setStyle(this.contentContainer.nativeElement, 'width', width);
1444
- this.renderer2.setStyle(this.contentContainer.nativeElement, 'height', height);
1445
- this.renderer2.setStyle(this.contentContainer.nativeElement, 'maxWidth', width);
1446
- this.renderer2.setStyle(this.contentContainer.nativeElement, 'maxHeight', height);
1447
- }
1448
- setMatrix() {
1449
- const viewBox = this.viewBox;
1450
- const zoom = this.zoom;
1451
- this.matrix = [zoom, 0, 0, 0, zoom, 0, -this.scrollLeft - zoom * viewBox[0], -this.scrollTop - zoom * viewBox[1], 1];
1452
- }
1453
- updateViewport() {
1454
- const clientBox = getViewportClientBox(this.board);
1455
- this.setViewport(this.board.viewport.zoom, [clientBox.x, clientBox.y]);
1456
- }
1457
- setViewport(zoom, focusPoint) {
1458
- zoom = zoom ?? this.zoom;
1459
- zoom = calculateZoom(zoom);
1460
- if (zoom !== this.zoom) {
1461
- this.zoom = zoom;
1462
- }
1463
- focusPoint = focusPoint ?? this.focusPoint;
1508
+ updateViewportState(state) {
1509
+ this.viewportState = {
1510
+ ...this.viewportState,
1511
+ ...state
1512
+ };
1513
+ }
1514
+ initViewportContainer() {
1515
+ const { width, height } = getBoardClientBox(this.board);
1516
+ this.renderer2.setStyle(this.viewportContainer.nativeElement, 'width', `${width}px`);
1517
+ this.renderer2.setStyle(this.viewportContainer.nativeElement, 'height', `${height}px`);
1518
+ }
1519
+ initViewport() {
1520
+ const viewport = this.board.viewport;
1521
+ const originationCoord = viewport?.originationCoord;
1522
+ const zoom = viewport?.zoom ?? this.viewportState.zoom;
1523
+ if (originationCoord) {
1524
+ const matrix = this.getMatrix();
1525
+ const [pointX, pointY] = invertViewportCoordinates([0, 0], matrix);
1526
+ const scrollLeft = this.viewportState.scrollLeft;
1527
+ const scrollTop = this.viewportState.scrollTop;
1528
+ const left = scrollLeft + (originationCoord[0] - pointX) * zoom;
1529
+ const top = scrollTop + (originationCoord[1] - pointY) * zoom;
1530
+ this.setScroll(left, top);
1531
+ }
1532
+ else {
1533
+ this.adaptHandle();
1534
+ }
1535
+ }
1536
+ calcViewBox(zoom = this.viewportState.zoom) {
1537
+ zoom = clampZoomLevel(zoom);
1538
+ const scrollBarWidth = this.viewportState.scrollBarWidth;
1539
+ const viewportContainerBox = getViewportContainerBox(this.board);
1540
+ const groupBBox = getRootGroupBBox(this.board, zoom);
1541
+ const horizontalPadding = viewportContainerBox.width / 2;
1542
+ const verticalPadding = viewportContainerBox.height / 2;
1543
+ const viewportWidth = (groupBBox.right - groupBBox.left) * zoom + 2 * horizontalPadding + scrollBarWidth;
1544
+ const viewportHeight = (groupBBox.bottom - groupBBox.top) * zoom + 2 * verticalPadding + scrollBarWidth;
1545
+ const viewBox = [
1546
+ groupBBox.left - horizontalPadding / zoom,
1547
+ groupBBox.top - verticalPadding / zoom,
1548
+ viewportWidth / zoom,
1549
+ viewportHeight / zoom
1550
+ ];
1551
+ const matrix = this.getMatrix();
1464
1552
  let scrollLeft;
1465
1553
  let scrollTop;
1466
- const clientBox = getViewportClientBox(this.board);
1467
- const matrix = this.matrix;
1468
- const box = calculateBBox(this.board, zoom);
1469
- const padding = [this.height / 2, this.width / 2];
1470
- const rootGroupWidth = box.right - box.left;
1471
- const rootGroupHeight = box.bottom - box.top;
1472
- const canvasWidth = rootGroupWidth * zoom + 2 * padding[1];
1473
- const canvasHeight = rootGroupHeight * zoom + 2 * padding[0];
1474
- const viewBox = [box.left - padding[1] / zoom, box.top - padding[0] / zoom, canvasWidth / zoom, canvasHeight / zoom];
1475
- if (matrix) {
1476
- const canvasPoint = [focusPoint[0] - clientBox.x, focusPoint[1] - clientBox.y, 1];
1477
- const invertMatrix = invert([], matrix);
1478
- const matrix1 = transformMat3([], [canvasPoint[0], canvasPoint[1], 1], invertMatrix);
1479
- const matrix2 = [zoom, 0, 0, 0, zoom, 0, -zoom * viewBox[0], -zoom * viewBox[1], 1];
1480
- const newMatrix = transformMat3([], matrix1, matrix2);
1481
- scrollLeft = newMatrix[0] - canvasPoint[0];
1482
- scrollTop = newMatrix[1] - canvasPoint[1];
1554
+ if (matrix.length > 0) {
1555
+ // focusPoint
1556
+ const focusX = viewportContainerBox.x + viewportContainerBox.width / 2;
1557
+ const focusY = viewportContainerBox.y + viewportContainerBox.height / 2;
1558
+ const viewportContainerPoint = [focusX - viewportContainerBox.x, focusY - viewportContainerBox.y, 1];
1559
+ const point = invertViewportCoordinates([viewportContainerPoint[0], viewportContainerPoint[1]], matrix);
1560
+ const newMatrix = [zoom, 0, 0, 0, zoom, 0, -zoom * viewBox[0], -zoom * viewBox[1], 1];
1561
+ const newPoint = transformMat3([], point, newMatrix);
1562
+ scrollLeft = newPoint[0] - viewportContainerPoint[0];
1563
+ scrollTop = newPoint[1] - viewportContainerPoint[1];
1483
1564
  }
1484
1565
  else {
1485
- scrollLeft = (canvasWidth - clientBox.width) / 2;
1486
- scrollTop = padding[0] / 2 - box.top;
1566
+ scrollLeft = horizontalPadding;
1567
+ scrollTop = verticalPadding;
1487
1568
  }
1488
- this.canvasWidth = canvasWidth;
1489
- this.canvasHeight = canvasHeight;
1490
- this.zoom = zoom;
1491
- this.viewBox = viewBox;
1569
+ this.updateViewportState({
1570
+ viewportWidth,
1571
+ viewportHeight,
1572
+ zoom,
1573
+ viewBox
1574
+ });
1492
1575
  this.setScrollLeft(scrollLeft);
1493
1576
  this.setScrollTop(scrollTop);
1494
- this.change();
1577
+ }
1578
+ getMatrix() {
1579
+ const { viewBox, zoom, scrollLeft, scrollTop } = this.viewportState;
1580
+ if (scrollLeft >= 0 && scrollTop >= 0) {
1581
+ return [zoom, 0, 0, 0, zoom, 0, -scrollLeft - zoom * viewBox[0], -scrollTop - zoom * viewBox[1], 1];
1582
+ }
1583
+ return [];
1495
1584
  }
1496
1585
  setScrollLeft(left) {
1497
- const hideScrollbar = this.board.options.hideScrollbar;
1498
- const scrollBarWidth = hideScrollbar ? SCROLL_BAR_WIDTH : 0;
1499
- const width = this.canvasWidth - this.width + scrollBarWidth;
1500
- this.scrollLeft = left < 0 ? 0 : left > width ? width : left;
1586
+ const viewportContainerBox = getViewportContainerBox(this.board);
1587
+ const { viewportWidth, scrollBarWidth } = this.viewportState;
1588
+ const width = viewportWidth - viewportContainerBox.width + scrollBarWidth;
1589
+ this.viewportState.scrollLeft = left < 0 ? 0 : left > width ? width : left;
1501
1590
  }
1502
1591
  setScrollTop(top) {
1503
- const hideScrollbar = this.board.options.hideScrollbar;
1504
- const scrollBarWidth = hideScrollbar ? SCROLL_BAR_WIDTH : 0;
1505
- const height = this.canvasHeight - this.height + scrollBarWidth;
1506
- this.scrollTop = top < 0 ? 0 : top > height ? height : top;
1592
+ const viewportContainerBox = getViewportContainerBox(this.board);
1593
+ const { viewportHeight, scrollBarWidth } = this.viewportState;
1594
+ const height = viewportHeight - viewportContainerBox.height + scrollBarWidth;
1595
+ this.viewportState.scrollTop = top < 0 ? 0 : top > height ? height : top;
1507
1596
  }
1508
1597
  setScroll(left, top) {
1509
1598
  this.setScrollLeft(left);
1510
1599
  this.setScrollTop(top);
1511
- this.change();
1512
- }
1513
- moveTo(point, zoom) {
1514
- zoom = zoom ?? this.zoom;
1515
- const r = invertViewport([0, 0], this.matrix);
1516
- this.setScroll(this.scrollLeft + (point[0] - r[0]) * zoom, this.scrollTop + (point[1] - r[1]) * zoom);
1517
- }
1518
- scrollIntoView(node) {
1519
- const canvasRect = this.host.getBoundingClientRect();
1520
- if (!(canvasRect.width <= this.width && canvasRect.height <= this.height)) {
1521
- const point = convertViewport([node.x, node.y], this.matrix);
1522
- const fullPoint = convertViewport([node.x + node.width, node.y + node.height], this.matrix);
1523
- const width = this.width;
1524
- const height = this.height;
1525
- let left = this.scrollLeft;
1526
- let top = this.scrollTop;
1527
- if (fullPoint[0] > width - SCROLL_BAR_WIDTH) {
1528
- left += fullPoint[0] - width + SCROLL_BAR_WIDTH;
1529
- }
1530
- if (fullPoint[1] > height - SCROLL_BAR_WIDTH) {
1531
- top += fullPoint[1] - height + SCROLL_BAR_WIDTH;
1532
- }
1533
- (left === this.scrollLeft && top === this.scrollTop) || this.setScroll(left, top);
1534
- }
1535
- }
1536
- change() {
1537
- this.resizeViewport();
1538
- this.renderer2.setStyle(this.host, 'display', 'block');
1539
- this.renderer2.setStyle(this.host, 'width', `${this.canvasWidth}px`);
1540
- this.renderer2.setStyle(this.host, 'height', `${this.canvasHeight}px`);
1541
- if (this.viewBox && this.viewBox[2] > 0 && this.viewBox[3] > 0) {
1542
- this.renderer2.setAttribute(this.host, 'viewBox', this.viewBox.join(','));
1600
+ this.updateViewBoxStyles();
1601
+ this.updateViewportScrolling();
1602
+ this.setViewport();
1603
+ }
1604
+ updateViewBoxStyles() {
1605
+ const { host, viewportState } = this;
1606
+ const { viewportWidth, viewportHeight, viewBox } = viewportState;
1607
+ this.renderer2.setStyle(host, 'display', 'block');
1608
+ this.renderer2.setStyle(host, 'width', `${viewportWidth}px`);
1609
+ this.renderer2.setStyle(host, 'height', `${viewportHeight}px`);
1610
+ if (viewBox && viewBox[2] > 0 && viewBox[3] > 0) {
1611
+ this.renderer2.setAttribute(host, 'viewBox', viewBox.join(' '));
1543
1612
  }
1544
- this.contentContainer.nativeElement.scrollLeft = this.scrollLeft;
1545
- this.contentContainer.nativeElement.scrollTop = this.scrollTop;
1546
- this.setMatrix();
1547
- this.setViewportSetting();
1548
- this.viewportCanvasBox = getViewportCanvasBox(this.board, this.matrix);
1549
1613
  }
1550
- restoreCanvasPoint(point, zoom) {
1551
- zoom = zoom ?? this.zoom;
1552
- this.setViewport(zoom);
1553
- this.moveTo(point, zoom);
1614
+ updateViewportScrolling() {
1615
+ const { viewportContainer, viewportState } = this;
1616
+ const { scrollLeft, scrollTop } = viewportState;
1617
+ viewportContainer.nativeElement.scrollLeft = scrollLeft;
1618
+ viewportContainer.nativeElement.scrollTop = scrollTop;
1554
1619
  }
1555
- initCanvas(viewport) {
1556
- const canvasPoint = viewport?.canvasPoint;
1557
- if (canvasPoint) {
1558
- this.restoreCanvasPoint(canvasPoint, viewport.zoom);
1559
- }
1560
- else {
1561
- this.setViewport(viewport.zoom);
1562
- this.setScroll(this.scrollLeft, this.scrollTop);
1563
- }
1564
- }
1565
- focusGraphicCenter() {
1566
- const rootGroup = this.board.host.firstChild;
1567
- const rootGroupBox = rootGroup.getBBox();
1568
- this.focus([rootGroupBox.x + rootGroupBox.width / 2, rootGroupBox.y + rootGroupBox.height / 2]);
1569
- this.change();
1570
- this.setViewport(1);
1571
- }
1572
- focus(point) {
1573
- const clientBox = getViewportClientBox(this.board);
1574
- const matrix = transformMat3([], [point[0], point[1], 1], this.matrix);
1575
- const newPoint = [clientBox.width / 2, clientBox.height / 2];
1576
- const scrollLeft = newPoint[0] - matrix[0];
1577
- const scrollTop = newPoint[1] - matrix[1];
1578
- this.setScrollLeft(this.scrollLeft - scrollLeft);
1579
- this.setScrollTop(this.scrollTop - scrollTop);
1580
- this.setMatrix();
1581
- }
1582
- resetFocusPoint() {
1583
- const clientBox = getViewportClientBox(this.board);
1584
- this.focusPoint = [clientBox.x + clientBox.width / 2, clientBox.y + clientBox.height / 2];
1585
- }
1586
- setViewportSetting() {
1620
+ setViewport() {
1587
1621
  const viewport = this.board?.viewport;
1588
- Transforms.setViewport(this.board, {
1589
- ...viewport,
1590
- zoom: this.zoom,
1591
- canvasPoint: invertViewport([0, 0], this.matrix)
1592
- });
1593
- }
1594
- changeSize() {
1595
- this.updateViewport();
1596
- }
1597
- // 拖拽模式
1598
- changeMoveMode(cursorStatus) {
1599
- updateCursorStatus(this.board, cursorStatus);
1600
- this.cdr.markForCheck();
1622
+ const oldOriginationCoord = viewport?.originationCoord ?? [];
1623
+ const matrix = this.getMatrix();
1624
+ const originationCoord = invertViewportCoordinates([0, 0], matrix);
1625
+ if (!originationCoord.every((item, index) => item === oldOriginationCoord[index])) {
1626
+ Transforms.setViewport(this.board, {
1627
+ ...viewport,
1628
+ zoom: this.viewportState.zoom,
1629
+ originationCoord
1630
+ });
1631
+ }
1601
1632
  }
1602
- // 适应画布
1603
1633
  adaptHandle() {
1604
- const clientBox = getViewportClientBox(this.board);
1634
+ const containerBox = getViewportContainerBox(this.board);
1605
1635
  const rootGroup = this.host.firstChild;
1636
+ const matrix = this.getMatrix();
1606
1637
  const rootGroupBox = rootGroup.getBBox();
1607
- const viewportWidth = clientBox.width - 2 * this.autoFitPadding;
1608
- const viewportHeight = clientBox.height - 2 * this.autoFitPadding;
1609
- let zoom = this.zoom;
1638
+ const centerPoint = [containerBox.width / 2, containerBox.height / 2];
1639
+ const rootGroupCenterX = rootGroupBox.x + rootGroupBox.width / 2;
1640
+ const rootGroupCenterY = rootGroupBox.y + rootGroupBox.height / 2;
1641
+ const transformedPoint = transformMat3([], [rootGroupCenterX, rootGroupCenterY, 1], matrix);
1642
+ const offsetLeft = centerPoint[0] - transformedPoint[0];
1643
+ const offsetTop = centerPoint[1] - transformedPoint[1];
1644
+ const { autoFitPadding, zoom, scrollLeft, scrollTop } = this.viewportState;
1645
+ const viewportWidth = containerBox.width - 2 * autoFitPadding;
1646
+ const viewportHeight = containerBox.height - 2 * autoFitPadding;
1647
+ let newZoom = zoom;
1610
1648
  if (viewportWidth < rootGroupBox.width || viewportHeight < rootGroupBox.height) {
1611
- zoom = Math.min(viewportWidth / rootGroupBox.width, viewportHeight / rootGroupBox.height);
1649
+ newZoom = Math.min(viewportWidth / rootGroupBox.width, viewportHeight / rootGroupBox.height);
1612
1650
  }
1613
1651
  else {
1614
- zoom = 1;
1652
+ newZoom = 1;
1615
1653
  }
1616
- this.focus([rootGroupBox.x + rootGroupBox.width / 2, rootGroupBox.y + rootGroupBox.height / 2]);
1617
- this.resetFocusPoint();
1618
- this.setViewport(zoom);
1654
+ this.setScrollLeft(scrollLeft - offsetLeft);
1655
+ this.setScrollTop(scrollTop - offsetTop);
1656
+ this.calcViewBox(newZoom);
1657
+ this.updateViewBoxStyles();
1658
+ this.updateViewportScrolling();
1659
+ this.setViewport();
1619
1660
  }
1620
- // 放大
1621
1661
  zoomInHandle() {
1622
- this.setViewport(this.zoom + 0.1);
1662
+ this.calcViewBox(this.viewportState.zoom + 0.1);
1663
+ this.updateViewBoxStyles();
1664
+ this.updateViewportScrolling();
1665
+ this.setViewport();
1623
1666
  }
1624
- // 缩小
1625
1667
  zoomOutHandle() {
1626
- this.setViewport(this.zoom - 0.1);
1668
+ this.calcViewBox(this.viewportState.zoom - 0.1);
1669
+ this.updateViewBoxStyles();
1670
+ this.updateViewportScrolling();
1671
+ this.setViewport();
1627
1672
  }
1628
1673
  resetZoomHandel() {
1629
- this.setViewport(1);
1674
+ this.calcViewBox(1);
1675
+ this.updateViewBoxStyles();
1676
+ this.updateViewportScrolling();
1677
+ this.setViewport();
1678
+ }
1679
+ movingChange(isMoving) {
1680
+ this.isMoving = isMoving;
1630
1681
  }
1631
1682
  ngOnDestroy() {
1632
1683
  this.destroy$.next();
@@ -1636,58 +1687,83 @@ class PlaitBoardComponent {
1636
1687
  this.resizeObserver.disconnect();
1637
1688
  }
1638
1689
  }
1639
- movingChange(isMoving) {
1640
- this.isMoving = isMoving;
1690
+ markForCheck() {
1691
+ this.cdr.markForCheck();
1692
+ }
1693
+ scrollToRectangle(client) {
1694
+ this.calcViewBox();
1695
+ this.updateViewBoxStyles();
1696
+ this.updateViewportScrolling();
1697
+ this.setViewport();
1698
+ const svgRect = this.host.getBoundingClientRect();
1699
+ const viewportContainerBox = getViewportContainerBox(this.board);
1700
+ if (svgRect.width > viewportContainerBox.width || svgRect.height > viewportContainerBox.height) {
1701
+ const matrix = this.getMatrix();
1702
+ const scrollBarWidth = this.viewportState.scrollBarWidth;
1703
+ const [nodePointX, nodePointY] = convertToViewportCoordinates([client.x, client.y], matrix);
1704
+ const [fullNodePointX, fullNodePointY] = convertToViewportCoordinates([client.x + client.width, client.y + client.height], matrix);
1705
+ let newLeft = this.viewportState.scrollLeft;
1706
+ let newTop = this.viewportState.scrollTop;
1707
+ if (nodePointX < 0) {
1708
+ newLeft -= Math.abs(nodePointX);
1709
+ }
1710
+ if (nodePointX > 0 && fullNodePointX > viewportContainerBox.width) {
1711
+ newLeft += fullNodePointX - viewportContainerBox.width + scrollBarWidth;
1712
+ }
1713
+ if (nodePointY < 0) {
1714
+ newTop -= Math.abs(nodePointY);
1715
+ }
1716
+ if (nodePointY > 0 && fullNodePointY > viewportContainerBox.height) {
1717
+ newTop += fullNodePointY - viewportContainerBox.height + scrollBarWidth;
1718
+ }
1719
+ if (newLeft !== this.viewportState.scrollLeft || newTop !== this.viewportState.scrollTop) {
1720
+ this.setScroll(newLeft, newTop);
1721
+ }
1722
+ }
1641
1723
  }
1642
1724
  }
1643
1725
  PlaitBoardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlaitBoardComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1644
- PlaitBoardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PlaitBoardComponent, selector: "plait-board", inputs: { plaitValue: "plaitValue", plaitViewport: "plaitViewport", plaitPlugins: "plaitPlugins", plaitOptions: "plaitOptions" }, outputs: { plaitChange: "plaitChange", plaitBoardInitialized: "plaitBoardInitialized" }, host: { properties: { "class": "this.hostClass", "class.readonly": "this.readonly", "class.moving": "this.moving", "class.focused": "this.focused" } }, queries: [{ propertyName: "toolbarTemplateRef", first: true, predicate: ["plaitToolbar"], descendants: true }], viewQueries: [{ propertyName: "svg", first: true, predicate: ["svg"], descendants: true, static: true }, { propertyName: "contentContainer", first: true, predicate: ["container"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
1645
- <div class="viewport-container" #container>
1726
+ PlaitBoardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PlaitBoardComponent, selector: "plait-board", inputs: { plaitValue: "plaitValue", plaitViewport: "plaitViewport", plaitPlugins: "plaitPlugins", plaitOptions: "plaitOptions" }, outputs: { plaitChange: "plaitChange", plaitBoardInitialized: "plaitBoardInitialized" }, host: { properties: { "class": "this.hostClass", "class.readonly": "this.readonly", "class.moving": "this.moving", "class.focused": "this.focused" } }, queries: [{ propertyName: "toolbarTemplateRef", first: true, predicate: ["plaitToolbar"], descendants: true }], viewQueries: [{ propertyName: "svg", first: true, predicate: ["svg"], descendants: true, static: true }, { propertyName: "viewportContainer", first: true, predicate: ["viewportContainer"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: `
1727
+ <div class="viewport-container" #viewportContainer>
1646
1728
  <svg #svg width="100%" height="100%" style="position: relative;"></svg>
1647
1729
  <plait-element
1648
1730
  *ngFor="let item of board.children; let index = index; trackBy: trackBy"
1649
1731
  [index]="index"
1650
1732
  [element]="item"
1651
1733
  [board]="board"
1652
- [viewport]="board.viewport"
1653
1734
  [selection]="board.selection"
1654
1735
  [host]="host"
1655
1736
  ></plait-element>
1656
1737
  </div>
1657
1738
  <plait-toolbar
1658
1739
  *ngIf="isFocused && !toolbarTemplateRef"
1659
- [cursorStatus]="board.cursor"
1660
- [viewZoom]="board.viewport!.zoom"
1661
- (moveHandle)="changeMoveMode($event)"
1740
+ [board]="board"
1662
1741
  (adaptHandle)="adaptHandle()"
1663
1742
  (zoomInHandle)="zoomInHandle()"
1664
1743
  (zoomOutHandle)="zoomOutHandle()"
1665
1744
  (resetZoomHandel)="resetZoomHandel()"
1666
1745
  ></plait-toolbar>
1667
1746
  <ng-content></ng-content>
1668
- `, isInline: true, components: [{ type: PlaitElementComponent, selector: "plait-element", inputs: ["index", "element", "board", "viewport", "selection", "host"] }, { type: PlaitToolbarComponent, selector: "plait-toolbar", inputs: ["cursorStatus", "viewZoom"], outputs: ["moveHandle", "adaptHandle", "zoomInHandle", "zoomOutHandle", "resetZoomHandel"] }], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1747
+ `, isInline: true, components: [{ type: PlaitElementComponent, selector: "plait-element", inputs: ["index", "element", "board", "viewport", "selection", "host"] }, { type: PlaitToolbarComponent, selector: "plait-toolbar", inputs: ["board"], outputs: ["adaptHandle", "zoomInHandle", "zoomOutHandle", "resetZoomHandel"] }], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1669
1748
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlaitBoardComponent, decorators: [{
1670
1749
  type: Component,
1671
1750
  args: [{
1672
1751
  selector: 'plait-board',
1673
1752
  template: `
1674
- <div class="viewport-container" #container>
1753
+ <div class="viewport-container" #viewportContainer>
1675
1754
  <svg #svg width="100%" height="100%" style="position: relative;"></svg>
1676
1755
  <plait-element
1677
1756
  *ngFor="let item of board.children; let index = index; trackBy: trackBy"
1678
1757
  [index]="index"
1679
1758
  [element]="item"
1680
1759
  [board]="board"
1681
- [viewport]="board.viewport"
1682
1760
  [selection]="board.selection"
1683
1761
  [host]="host"
1684
1762
  ></plait-element>
1685
1763
  </div>
1686
1764
  <plait-toolbar
1687
1765
  *ngIf="isFocused && !toolbarTemplateRef"
1688
- [cursorStatus]="board.cursor"
1689
- [viewZoom]="board.viewport!.zoom"
1690
- (moveHandle)="changeMoveMode($event)"
1766
+ [board]="board"
1691
1767
  (adaptHandle)="adaptHandle()"
1692
1768
  (zoomInHandle)="zoomInHandle()"
1693
1769
  (zoomOutHandle)="zoomOutHandle()"
@@ -1727,10 +1803,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1727
1803
  }], toolbarTemplateRef: [{
1728
1804
  type: ContentChild,
1729
1805
  args: ['plaitToolbar']
1730
- }], contentContainer: [{
1806
+ }], viewportContainer: [{
1731
1807
  type: ViewChild,
1732
- args: ['container', { read: ElementRef, static: true }]
1808
+ args: ['viewportContainer', { read: ElementRef, static: true }]
1809
+ }] } });
1810
+
1811
+ function hasBeforeContextChange(value) {
1812
+ if (value.beforeContextChange) {
1813
+ return true;
1814
+ }
1815
+ return false;
1816
+ }
1817
+
1818
+ class PlaitPluginElementComponent {
1819
+ constructor(cdr) {
1820
+ this.cdr = cdr;
1821
+ this.initialized = false;
1822
+ this.g = createG();
1823
+ }
1824
+ set context(value) {
1825
+ if (hasBeforeContextChange(this)) {
1826
+ this.beforeContextChange(value);
1827
+ }
1828
+ this._context = value;
1829
+ if (this.element) {
1830
+ ELEMENT_TO_PLUGIN_COMPONENT.set(this.element, this);
1831
+ }
1832
+ this.onContextChange();
1833
+ }
1834
+ get context() {
1835
+ return this._context;
1836
+ }
1837
+ get element() {
1838
+ return this.context && this.context.element;
1839
+ }
1840
+ get selection() {
1841
+ return this.context && this.context.selection;
1842
+ }
1843
+ get board() {
1844
+ return this.context && this.context.board;
1845
+ }
1846
+ get host() {
1847
+ return this.context && this.context.host;
1848
+ }
1849
+ onContextChange() {
1850
+ if (!this.initialized) {
1851
+ return;
1852
+ }
1853
+ this.cdr.markForCheck();
1854
+ }
1855
+ ngOnInit() {
1856
+ const type = this.element?.type || 'default-plugin-element';
1857
+ this.g.setAttribute(`plait-${type}`, 'true');
1858
+ this.initialized = true;
1859
+ }
1860
+ ngOnDestroy() {
1861
+ ELEMENT_TO_PLUGIN_COMPONENT.delete(this.element);
1862
+ this.g.remove();
1863
+ }
1864
+ }
1865
+ PlaitPluginElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlaitPluginElementComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1866
+ PlaitPluginElementComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: PlaitPluginElementComponent, inputs: { context: "context" }, ngImport: i0 });
1867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlaitPluginElementComponent, decorators: [{
1868
+ type: Directive
1869
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { context: [{
1870
+ type: Input
1733
1871
  }] } });
1872
+ const ELEMENT_TO_PLUGIN_COMPONENT = new WeakMap();
1734
1873
 
1735
1874
  const COMPONENTS = [PlaitBoardComponent, PlaitElementComponent, PlaitToolbarComponent];
1736
1875
  class PlaitModule {
@@ -1755,5 +1894,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1755
1894
  * Generated bundle index. Do not edit.
1756
1895
  */
1757
1896
 
1758
- export { BOARD_TO_ON_CHANGE, BaseCursorStatus, CLIP_BOARD_FORMAT_KEY, FLUSHING, HOST_TO_ROUGH_SVG, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_IOS, IS_SAFARI, IS_TEXT_EDITABLE, MERGING, NS, PLAIT_BOARD_TO_COMPONENT, Path, PlaitBoardComponent, PlaitElementComponent, PlaitHistoryBoard, PlaitModule, PlaitNode, PlaitOperation, PlaitToolbarComponent, SAVING, SCROLL_BAR_WIDTH, Transforms, Viewport, calculateBBox, calculateZoom, convertPoint, convertViewport, createG, createSVG, createText, distanceBetweenPointAndPoint, distanceBetweenPointAndSegment, getGraphicsBBox, getViewportCanvasBox, getViewportClientBox, hotkeys, idCreator, inverse, invert, invertClient, invertViewport, isNoSelectionElement, isNullOrUndefined, isSetViewportOperation, rotate, shouldClear, shouldMerge, shouldSave, toPoint, toRectangleClient, transformMat3, transformPoint, transformPoints, updateCursorStatus };
1897
+ export { BOARD_TO_ON_CHANGE, CLIP_BOARD_FORMAT_KEY, ELEMENT_TO_PLUGIN_COMPONENT, FLUSHING, HOST_TO_ROUGH_SVG, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_IOS, IS_SAFARI, IS_TEXT_EDITABLE, MERGING, NS, PLAIT_BOARD_TO_COMPONENT, Path, PlaitBoardComponent, PlaitElementComponent, PlaitHistoryBoard, PlaitModule, PlaitNode, PlaitOperation, PlaitPluginElementComponent, PlaitPointerType, PlaitToolbarComponent, SAVING, SCROLL_BAR_WIDTH, Transforms, Viewport, clampZoomLevel, convertToViewportCoordinates, createG, createSVG, createText, distanceBetweenPointAndPoint, distanceBetweenPointAndSegment, getBoardClientBox, getRootGroupBBox, getViewportContainerBox, hasBeforeContextChange, hotkeys, idCreator, inverse, invertMatrix, invertViewportCoordinates, isNoSelectionElement, isNullOrUndefined, isSetViewportOperation, normalizePoint, rotate, shouldClear, shouldMerge, shouldSave, toPoint, toRectangleClient, transformMat3, transformPoint, transformPoints };
1759
1898
  //# sourceMappingURL=plait-core.mjs.map