@idraw/core 0.4.0-beta.37 → 0.4.0-beta.39

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.
@@ -1272,6 +1272,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
1272
1272
  _loop(elements);
1273
1273
  return positionMap;
1274
1274
  }
1275
+ function isSameElementSize(elem1, elem2) {
1276
+ return elem1.x === elem2.x && elem1.y === elem2.y && elem1.h === elem2.h && elem1.w === elem2.w && limitAngle(elem1.angle || 0) === limitAngle(elem2.angle || 0);
1277
+ }
1275
1278
  function getElementVertexes(elemSize) {
1276
1279
  const { x: x2, y: y2, h: h2, w: w2 } = elemSize;
1277
1280
  return [
@@ -1755,6 +1758,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
1755
1758
  });
1756
1759
  const rotateVertexes2 = calcElementVertexes(rotateSize);
1757
1760
  const sizeController = {
1761
+ originalElementCenter: calcElementCenter(elemSize),
1762
+ originalElementSize: Object.assign({}, elemSize),
1758
1763
  elementWrapper: vertexes,
1759
1764
  left: {
1760
1765
  type: "left",
@@ -2142,6 +2147,31 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
2142
2147
  }
2143
2148
  return t;
2144
2149
  });
2150
+ function calcPointMoveElementInGroup(start, end, groupQueue) {
2151
+ let moveX = end.x - start.x;
2152
+ let moveY = end.y - start.y;
2153
+ const pointGroupQueue = [];
2154
+ groupQueue.forEach((group) => {
2155
+ const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = group;
2156
+ pointGroupQueue.push({
2157
+ x: x2,
2158
+ y: y2,
2159
+ w: w2,
2160
+ h: h2,
2161
+ angle: 0 - angle2
2162
+ });
2163
+ });
2164
+ if ((groupQueue === null || groupQueue === void 0 ? void 0 : groupQueue.length) > 0) {
2165
+ const startInGroup = rotatePointInGroup(start, pointGroupQueue);
2166
+ const endInGroup = rotatePointInGroup(end, pointGroupQueue);
2167
+ moveX = endInGroup.x - startInGroup.x;
2168
+ moveY = endInGroup.y - startInGroup.y;
2169
+ }
2170
+ return {
2171
+ moveX,
2172
+ moveY
2173
+ };
2174
+ }
2145
2175
  function createColorStyle(ctx, color2, opts) {
2146
2176
  if (typeof color2 === "string") {
2147
2177
  return color2;
@@ -4251,6 +4281,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4251
4281
  __classPrivateFieldGet(this, _Board_instances, "m", _Board_resetActiveMiddlewareObjs).call(this);
4252
4282
  }
4253
4283
  }
4284
+ resetMiddlewareConfig(middleware, config) {
4285
+ var _a, _b;
4286
+ if (__classPrivateFieldGet(this, _Board_middlewareMap, "f").has(middleware)) {
4287
+ const item = __classPrivateFieldGet(this, _Board_middlewareMap, "f").get(middleware);
4288
+ if (item) {
4289
+ (_b = (_a = item.middlewareObject).resetConfig) === null || _b === void 0 ? void 0 : _b.call(_a, config);
4290
+ }
4291
+ }
4292
+ }
4254
4293
  scale(opts) {
4255
4294
  const viewer = __classPrivateFieldGet(this, _Board_viewer, "f");
4256
4295
  const { ignoreUpdateVisibleStatus } = opts;
@@ -4792,6 +4831,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4792
4831
  }
4793
4832
  }
4794
4833
  function drawSelectedElementControllersVertexes(ctx, controller, opts) {
4834
+ var _a;
4795
4835
  if (!controller) {
4796
4836
  return;
4797
4837
  }
@@ -4799,8 +4839,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4799
4839
  hideControllers,
4800
4840
  style,
4801
4841
  rotateControllerPattern,
4802
- viewSizeInfo
4803
- // calculator, element, viewScaleInfo, viewSizeInfo
4842
+ viewSizeInfo,
4843
+ element
4844
+ // calculator, viewScaleInfo, viewSizeInfo
4804
4845
  } = opts;
4805
4846
  const { devicePixelRatio = 1 } = viewSizeInfo;
4806
4847
  const { activeColor: activeColor2 } = style;
@@ -4813,19 +4854,21 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4813
4854
  drawVertexes(ctx, calcViewVertexes(topRight.vertexes, opts), ctrlOpts);
4814
4855
  drawVertexes(ctx, calcViewVertexes(bottomLeft.vertexes, opts), ctrlOpts);
4815
4856
  drawVertexes(ctx, calcViewVertexes(bottomRight.vertexes, opts), ctrlOpts);
4816
- drawCircleController(ctx, calcViewPointSize(rotate.center, opts), { ...ctrlOpts, size: rotate.size, borderWidth: 0 });
4817
- const rotateCenter = calcViewPointSize(rotate.center, opts);
4818
- ctx.drawImage(
4819
- rotateControllerPattern.canvas,
4820
- 0,
4821
- 0,
4822
- rotateControllerPattern.canvas.width / devicePixelRatio,
4823
- rotateControllerPattern.canvas.height / devicePixelRatio,
4824
- rotateCenter.x - rotate.size / 2,
4825
- rotateCenter.y - rotate.size / 2,
4826
- rotate.size,
4827
- rotate.size
4828
- );
4857
+ if (((_a = element == null ? void 0 : element.operations) == null ? void 0 : _a.rotatable) !== false) {
4858
+ drawCircleController(ctx, calcViewPointSize(rotate.center, opts), { ...ctrlOpts, size: rotate.size, borderWidth: 0 });
4859
+ const rotateCenter = calcViewPointSize(rotate.center, opts);
4860
+ ctx.drawImage(
4861
+ rotateControllerPattern.canvas,
4862
+ 0,
4863
+ 0,
4864
+ rotateControllerPattern.canvas.width / devicePixelRatio,
4865
+ rotateControllerPattern.canvas.height / devicePixelRatio,
4866
+ rotateCenter.x - rotate.size / 2,
4867
+ rotateCenter.y - rotate.size / 2,
4868
+ rotate.size,
4869
+ rotate.size
4870
+ );
4871
+ }
4829
4872
  }
4830
4873
  }
4831
4874
  function drawArea(ctx, opts) {
@@ -4940,7 +4983,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4940
4983
  return isPointInViewActiveVertexes(p, { ctx, vertexes, viewScaleInfo, viewSizeInfo });
4941
4984
  }
4942
4985
  function getPointTarget(p, opts) {
4943
- var _a, _b, _c;
4986
+ var _a, _b, _c, _d, _e;
4944
4987
  const target = {
4945
4988
  type: null,
4946
4989
  elements: [],
@@ -4951,7 +4994,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4951
4994
  const { ctx, data, calculator, selectedElements, viewScaleInfo, viewSizeInfo, areaSize, groupQueue, selectedElementController } = opts;
4952
4995
  if (selectedElementController) {
4953
4996
  const { left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight, rotate } = selectedElementController;
4954
- const ctrls = [left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight, rotate];
4997
+ const ctrls = [left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight];
4998
+ if ((selectedElements == null ? void 0 : selectedElements.length) === 1 && ((_b = (_a = selectedElements == null ? void 0 : selectedElements[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.rotatable) !== false) {
4999
+ ctrls.push(rotate);
5000
+ }
4955
5001
  for (let i = 0; i < ctrls.length; i++) {
4956
5002
  const ctrl = ctrls[i];
4957
5003
  if (isPointInViewActiveVertexes(p, { ctx, vertexes: ctrl.vertexes, viewSizeInfo, viewScaleInfo })) {
@@ -4966,7 +5012,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4966
5012
  }
4967
5013
  if (groupQueue && Array.isArray(groupQueue) && groupQueue.length > 0) {
4968
5014
  const lastGroup = groupQueue[groupQueue.length - 1];
4969
- if (((_a = lastGroup == null ? void 0 : lastGroup.detail) == null ? void 0 : _a.children) && Array.isArray((_b = lastGroup == null ? void 0 : lastGroup.detail) == null ? void 0 : _b.children)) {
5015
+ if (((_c = lastGroup == null ? void 0 : lastGroup.detail) == null ? void 0 : _c.children) && Array.isArray((_d = lastGroup == null ? void 0 : lastGroup.detail) == null ? void 0 : _d.children)) {
4970
5016
  for (let i = lastGroup.detail.children.length - 1; i >= 0; i--) {
4971
5017
  const child = lastGroup.detail.children[i];
4972
5018
  const vertexes = calcElementVertexesInGroup(child, { groupQueue });
@@ -4995,7 +5041,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4995
5041
  }
4996
5042
  if (data) {
4997
5043
  const { index, element } = calculator.getPointElement(p, { data, viewScaleInfo, viewSizeInfo });
4998
- if (index >= 0 && element && ((_c = element == null ? void 0 : element.operations) == null ? void 0 : _c.invisible) !== true) {
5044
+ if (index >= 0 && element && ((_e = element == null ? void 0 : element.operations) == null ? void 0 : _e.invisible) !== true) {
4999
5045
  target.elements = [element];
5000
5046
  target.type = "over-element";
5001
5047
  return target;
@@ -5643,31 +5689,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
5643
5689
  }
5644
5690
  return false;
5645
5691
  }
5646
- function calcMoveInGroup(start, end, groupQueue) {
5647
- let moveX = end.x - start.x;
5648
- let moveY = end.y - start.y;
5649
- const pointGroupQueue = [];
5650
- groupQueue.forEach((group) => {
5651
- const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = group;
5652
- pointGroupQueue.push({
5653
- x: x2,
5654
- y: y2,
5655
- w: w2,
5656
- h: h2,
5657
- angle: 0 - angle2
5658
- });
5659
- });
5660
- if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
5661
- const startInGroup = rotatePointInGroup(start, pointGroupQueue);
5662
- const endInGroup = rotatePointInGroup(end, pointGroupQueue);
5663
- moveX = endInGroup.x - startInGroup.x;
5664
- moveY = endInGroup.y - startInGroup.y;
5665
- }
5666
- return {
5667
- moveX,
5668
- moveY
5669
- };
5670
- }
5671
5692
  const unitSize = 2;
5672
5693
  function getViewBoxInfo(rectInfo) {
5673
5694
  const boxInfo = {
@@ -6006,12 +6027,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6006
6027
  const MiddlewareLayoutSelector = (opts, config) => {
6007
6028
  const { sharer, boardContent, calculator, viewer, eventHub } = opts;
6008
6029
  const { overlayContext } = boardContent;
6009
- const innerConfig = {
6030
+ let innerConfig = {
6010
6031
  ...defaultStyle$2,
6011
6032
  ...config
6012
6033
  };
6013
- const { activeColor: activeColor2 } = innerConfig;
6014
- const style = { activeColor: activeColor2 };
6015
6034
  let prevPoint = null;
6016
6035
  let prevIsHoverContent = null;
6017
6036
  let prevIsSelected = null;
@@ -6117,6 +6136,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6117
6136
  clear();
6118
6137
  resetController();
6119
6138
  },
6139
+ resetConfig(config2) {
6140
+ innerConfig = { ...innerConfig, ...config2 };
6141
+ },
6120
6142
  hover: (e) => {
6121
6143
  if (sharer.getSharedStorage(keyLayoutIsBusyMoving) === true) {
6122
6144
  return;
@@ -6299,6 +6321,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6299
6321
  if (isInElementAction()) {
6300
6322
  return;
6301
6323
  }
6324
+ const { activeColor: activeColor2 } = innerConfig;
6325
+ const style = { activeColor: activeColor2 };
6302
6326
  const { sharedStore, activeStore } = snapshot;
6303
6327
  const layoutActionType = sharedStore[keyLayoutActionType];
6304
6328
  const layoutIsHover = sharedStore[keyLayoutIsHoverContent];
@@ -6521,7 +6545,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6521
6545
  },
6522
6546
  parentOpacity: 1
6523
6547
  });
6524
- return context2d;
6548
+ return { context2d, fill };
6525
6549
  }
6526
6550
  const fontFamily$1 = "monospace";
6527
6551
  function drawSizeInfoText(ctx, opts) {
@@ -6647,15 +6671,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6647
6671
  const MiddlewareInfo = (opts, config) => {
6648
6672
  const { boardContent, calculator, eventHub } = opts;
6649
6673
  const { overlayContext } = boardContent;
6650
- const innerConfig = {
6674
+ let innerConfig = {
6651
6675
  ...defaltStyle,
6652
6676
  ...config
6653
6677
  };
6654
- const { textBackground, textColor: textColor2 } = innerConfig;
6655
- const style = {
6656
- textBackground,
6657
- textColor: textColor2
6658
- };
6659
6678
  let showAngleInfo = true;
6660
6679
  const showInfoAngleCallback = ({ show }) => {
6661
6680
  showAngleInfo = show;
@@ -6668,7 +6687,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6668
6687
  disuse() {
6669
6688
  eventHub.off(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
6670
6689
  },
6690
+ resetConfig(config2) {
6691
+ innerConfig = { ...innerConfig, ...config2 };
6692
+ },
6671
6693
  beforeDrawFrame({ snapshot }) {
6694
+ var _a;
6695
+ const { textBackground, textColor: textColor2 } = innerConfig;
6696
+ const style = {
6697
+ textBackground,
6698
+ textColor: textColor2
6699
+ };
6672
6700
  const { sharedStore } = snapshot;
6673
6701
  const selectedElementList = sharedStore[keySelectedElementList];
6674
6702
  const actionType = sharedStore[keyActionType];
@@ -6746,18 +6774,20 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6746
6774
  style
6747
6775
  });
6748
6776
  if (showAngleInfo) {
6749
- drawAngleInfoText(overlayContext, {
6750
- point: {
6751
- x: rectInfo.top.x + infoFontSize + 4,
6752
- y: rectInfo.top.y - infoFontSize * 2 - 18
6753
- },
6754
- rotateCenter: rectInfo.center,
6755
- angle: totalAngle,
6756
- text: angleText,
6757
- fontSize: infoFontSize,
6758
- lineHeight: infoLineHeight,
6759
- style
6760
- });
6777
+ if (((_a = elem.operations) == null ? void 0 : _a.rotatable) !== false) {
6778
+ drawAngleInfoText(overlayContext, {
6779
+ point: {
6780
+ x: rectInfo.top.x + infoFontSize + 4,
6781
+ y: rectInfo.top.y - infoFontSize * 2 - 18
6782
+ },
6783
+ rotateCenter: rectInfo.center,
6784
+ angle: totalAngle,
6785
+ text: angleText,
6786
+ fontSize: infoFontSize,
6787
+ lineHeight: infoLineHeight,
6788
+ style
6789
+ });
6790
+ }
6761
6791
  }
6762
6792
  }
6763
6793
  }
@@ -6766,12 +6796,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6766
6796
  };
6767
6797
  };
6768
6798
  const MiddlewareSelector = (opts, config) => {
6769
- const innerConfig = {
6799
+ let innerConfig = {
6770
6800
  ...defaultStyle$3,
6771
6801
  ...config
6772
6802
  };
6773
- const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
6774
- const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
6775
6803
  const { viewer, sharer, boardContent, calculator, eventHub } = opts;
6776
6804
  const { overlayContext } = boardContent;
6777
6805
  let prevPoint = null;
@@ -6779,8 +6807,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6779
6807
  let moveOriginalStartElementSize = null;
6780
6808
  let inBusyMode = null;
6781
6809
  let hasChangedData = null;
6782
- const rotateControllerPattern = createRotateControllerPattern({
6783
- fill: style.activeColor,
6810
+ let rotateControllerPattern = createRotateControllerPattern({
6811
+ fill: innerConfig.activeColor,
6784
6812
  devicePixelRatio: sharer.getActiveViewSizeInfo().devicePixelRatio
6785
6813
  });
6786
6814
  sharer.setSharedStorage(keyActionType, null);
@@ -6925,6 +6953,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6925
6953
  eventHub.off(coreEventKeys.SELECT_IN_GROUP, selectInGroupCallback);
6926
6954
  eventHub.off(coreEventKeys.SNAP_TO_GRID, setSnapToSnapCallback);
6927
6955
  },
6956
+ resetConfig(config2) {
6957
+ innerConfig = { ...innerConfig, ...config2 };
6958
+ },
6928
6959
  hover: (e) => {
6929
6960
  var _a, _b, _c, _d, _e;
6930
6961
  const layoutIsSelected = sharer.getSharedStorage(keyLayoutIsSelected);
@@ -7112,7 +7143,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7112
7143
  inBusyMode = "drag";
7113
7144
  eventHub.trigger(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, { show: false });
7114
7145
  if (data && (elems == null ? void 0 : elems.length) === 1 && moveOriginalStartElementSize && originalStart && end && ((_b = (_a = elems[0]) == null ? void 0 : _a.operations) == null ? void 0 : _b.locked) !== true) {
7115
- const { moveX, moveY } = calcMoveInGroup(originalStart, end, groupQueue);
7146
+ const { moveX, moveY } = calcPointMoveElementInGroup(originalStart, end, groupQueue);
7116
7147
  let totalMoveX = calculator.toGridNum(moveX / scale);
7117
7148
  let totalMoveY = calculator.toGridNum(moveY / scale);
7118
7149
  if (enableSnapToGrid === true) {
@@ -7417,8 +7448,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7417
7448
  },
7418
7449
  beforeDrawFrame({ snapshot }) {
7419
7450
  var _a;
7451
+ const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
7452
+ const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
7420
7453
  const { activeStore, sharedStore } = snapshot;
7421
7454
  const { scale, offsetLeft, offsetTop, offsetRight, offsetBottom, width, height, contextHeight, contextWidth, devicePixelRatio } = activeStore;
7455
+ if (rotateControllerPattern.fill !== activeColor2) {
7456
+ rotateControllerPattern = createRotateControllerPattern({
7457
+ fill: innerConfig.activeColor,
7458
+ devicePixelRatio
7459
+ });
7460
+ }
7422
7461
  const sharer2 = opts.sharer;
7423
7462
  const viewScaleInfo = { scale, offsetLeft, offsetTop, offsetRight, offsetBottom };
7424
7463
  const viewSizeInfo = { width, height, contextHeight, contextWidth, devicePixelRatio };
@@ -7434,7 +7473,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7434
7473
  const isMoving = sharedStore[keyIsMoving];
7435
7474
  const enableSnapToGrid = sharedStore[keyEnableSnapToGrid];
7436
7475
  const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo, style };
7437
- const selectedElementController = sharedStore[keySelectedElementController];
7476
+ let selectedElementController = sharedStore[keySelectedElementController];
7477
+ if (selectedElementController && selectedElements.length === 1 && elem) {
7478
+ if (!isSameElementSize(elem, selectedElementController.originalElementSize)) {
7479
+ selectedElementController = calcElementSizeController(elem, {
7480
+ groupQueue: groupQueue || [],
7481
+ controllerSize: controllerSize$1,
7482
+ viewScaleInfo,
7483
+ rotateControllerPosition,
7484
+ rotateControllerSize
7485
+ });
7486
+ sharer2.setSharedStorage(keySelectedElementController, selectedElementController);
7487
+ }
7488
+ }
7438
7489
  const isHoverLocked = !!((_a = hoverElement == null ? void 0 : hoverElement.operations) == null ? void 0 : _a.locked);
7439
7490
  if ((groupQueue == null ? void 0 : groupQueue.length) > 0) {
7440
7491
  drawGroupQueueVertexesWrappers(overlayContext, groupQueueVertexesList, drawBaseOpts);
@@ -7455,7 +7506,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7455
7506
  element: elem,
7456
7507
  calculator,
7457
7508
  hideControllers: !!isMoving && actionType === "drag",
7458
- rotateControllerPattern,
7509
+ rotateControllerPattern: rotateControllerPattern.context2d,
7459
7510
  style
7460
7511
  });
7461
7512
  if (actionType === "drag") {
@@ -7498,7 +7549,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7498
7549
  element: elem,
7499
7550
  calculator,
7500
7551
  hideControllers: !!isMoving && actionType === "drag",
7501
- rotateControllerPattern,
7552
+ rotateControllerPattern: rotateControllerPattern.context2d,
7502
7553
  style
7503
7554
  });
7504
7555
  if (actionType === "drag") {
@@ -7751,19 +7802,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7751
7802
  sharer.setSharedStorage(keyXThumbRect, null);
7752
7803
  sharer.setSharedStorage(keyYThumbRect, null);
7753
7804
  let isBusy = false;
7754
- const innerConfig = {
7805
+ let innerConfig = {
7755
7806
  ...defaultStyle$1,
7756
7807
  ...config
7757
7808
  };
7758
- const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor, activeThumbBackground, activeThumbBorderColor } = innerConfig;
7759
- const style = {
7760
- thumbBackground,
7761
- thumbBorderColor,
7762
- hoverThumbBackground,
7763
- hoverThumbBorderColor,
7764
- activeThumbBackground,
7765
- activeThumbBorderColor
7766
- };
7767
7809
  const clear = () => {
7768
7810
  sharer.setSharedStorage(keyPrevPoint$1, null);
7769
7811
  sharer.setSharedStorage(keyActivePoint, null);
@@ -7805,6 +7847,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7805
7847
  };
7806
7848
  return {
7807
7849
  name: "@middleware/scroller",
7850
+ resetConfig(config2) {
7851
+ innerConfig = { ...innerConfig, ...config2 };
7852
+ },
7808
7853
  wheel: (e) => {
7809
7854
  viewer.scroll({
7810
7855
  moveX: 0 - e.deltaX,
@@ -7867,6 +7912,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7867
7912
  }
7868
7913
  },
7869
7914
  beforeDrawFrame({ snapshot }) {
7915
+ const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor, activeThumbBackground, activeThumbBorderColor } = innerConfig;
7916
+ const style = {
7917
+ thumbBackground,
7918
+ thumbBorderColor,
7919
+ hoverThumbBackground,
7920
+ hoverThumbBorderColor,
7921
+ activeThumbBackground,
7922
+ activeThumbBorderColor
7923
+ };
7870
7924
  const { xThumbRect, yThumbRect } = drawScroller(overlayContext, { snapshot, style });
7871
7925
  sharer.setSharedStorage(keyXThumbRect, xThumbRect);
7872
7926
  sharer.setSharedStorage(keyYThumbRect, yThumbRect);
@@ -8071,13 +8125,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
8071
8125
  const { width, height } = viewSizeInfo;
8072
8126
  const { background: background2, borderColor: borderColor2 } = style;
8073
8127
  ctx.beginPath();
8074
- ctx.moveTo(0, 0);
8075
- ctx.lineTo(width + 1, 0);
8128
+ const basePosition = -1;
8129
+ ctx.moveTo(basePosition, basePosition);
8130
+ ctx.lineTo(width + 1, basePosition);
8076
8131
  ctx.lineTo(width + 1, rulerSize);
8077
8132
  ctx.lineTo(rulerSize, rulerSize);
8078
8133
  ctx.lineTo(rulerSize, height + 1);
8079
- ctx.lineTo(0, height + 1);
8080
- ctx.lineTo(0, 0);
8134
+ ctx.lineTo(basePosition, height + 1);
8135
+ ctx.lineTo(basePosition, basePosition);
8081
8136
  ctx.closePath();
8082
8137
  ctx.fillStyle = background2;
8083
8138
  ctx.fill();
@@ -8176,20 +8231,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
8176
8231
  const MiddlewareRuler = (opts, config) => {
8177
8232
  const { boardContent, viewer, eventHub, calculator } = opts;
8178
8233
  const { overlayContext, underlayContext } = boardContent;
8179
- const innerConfig = {
8234
+ let innerConfig = {
8180
8235
  ...defaultStyle,
8181
8236
  ...config
8182
8237
  };
8183
- const { background: background2, borderColor: borderColor2, scaleColor: scaleColor2, textColor: textColor2, gridColor: gridColor2, gridPrimaryColor: gridPrimaryColor2, selectedAreaColor: selectedAreaColor2 } = innerConfig;
8184
- const style = {
8185
- background: background2,
8186
- borderColor: borderColor2,
8187
- scaleColor: scaleColor2,
8188
- textColor: textColor2,
8189
- gridColor: gridColor2,
8190
- gridPrimaryColor: gridPrimaryColor2,
8191
- selectedAreaColor: selectedAreaColor2
8192
- };
8193
8238
  let show = true;
8194
8239
  let showGrid = true;
8195
8240
  const rulerCallback = (e) => {
@@ -8211,7 +8256,20 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
8211
8256
  disuse() {
8212
8257
  eventHub.off(coreEventKeys.RULER, rulerCallback);
8213
8258
  },
8259
+ resetConfig(config2) {
8260
+ innerConfig = { ...innerConfig, ...config2 };
8261
+ },
8214
8262
  beforeDrawFrame: ({ snapshot }) => {
8263
+ const { background: background2, borderColor: borderColor2, scaleColor: scaleColor2, textColor: textColor2, gridColor: gridColor2, gridPrimaryColor: gridPrimaryColor2, selectedAreaColor: selectedAreaColor2 } = innerConfig;
8264
+ const style = {
8265
+ background: background2,
8266
+ borderColor: borderColor2,
8267
+ scaleColor: scaleColor2,
8268
+ textColor: textColor2,
8269
+ gridColor: gridColor2,
8270
+ gridPrimaryColor: gridPrimaryColor2,
8271
+ selectedAreaColor: selectedAreaColor2
8272
+ };
8215
8273
  if (show === true) {
8216
8274
  const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
8217
8275
  const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
@@ -8585,6 +8643,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
8585
8643
  disuse(middleware) {
8586
8644
  __privateGet(this, _board).disuse(middleware);
8587
8645
  }
8646
+ resetMiddlewareConfig(middleware, config) {
8647
+ __privateGet(this, _board).resetMiddlewareConfig(middleware, config);
8648
+ }
8588
8649
  setData(data, opts) {
8589
8650
  validateElements((data == null ? void 0 : data.elements) || []);
8590
8651
  __privateGet(this, _board).setData(data, opts);