@idraw/core 0.4.0-beta.38 → 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.
@@ -17,6 +17,7 @@ export declare class Core<E extends CoreEventMap = CoreEventMap> {
17
17
  destroy(): void;
18
18
  use<C extends any = any>(middleware: BoardMiddleware<any, any, any>, config?: C): void;
19
19
  disuse(middleware: BoardMiddleware<any, any, any>): void;
20
+ resetMiddlewareConfig<C extends any = any>(middleware: BoardMiddleware<any, any, any>, config?: Partial<C>): void;
20
21
  setData(data: Data, opts?: {
21
22
  modifiedOptions?: ModifyOptions;
22
23
  }): void;
package/dist/esm/index.js CHANGED
@@ -66,6 +66,9 @@ export class Core {
66
66
  disuse(middleware) {
67
67
  __classPrivateFieldGet(this, _Core_board, "f").disuse(middleware);
68
68
  }
69
+ resetMiddlewareConfig(middleware, config) {
70
+ __classPrivateFieldGet(this, _Core_board, "f").resetMiddlewareConfig(middleware, config);
71
+ }
69
72
  setData(data, opts) {
70
73
  validateElements((data === null || data === void 0 ? void 0 : data.elements) || []);
71
74
  __classPrivateFieldGet(this, _Core_board, "f").setData(data, opts);
@@ -8,12 +8,7 @@ const infoLineHeight = 16;
8
8
  export const MiddlewareInfo = (opts, config) => {
9
9
  const { boardContent, calculator, eventHub } = opts;
10
10
  const { overlayContext } = boardContent;
11
- const innerConfig = Object.assign(Object.assign({}, defaltStyle), config);
12
- const { textBackground, textColor } = innerConfig;
13
- const style = {
14
- textBackground,
15
- textColor
16
- };
11
+ let innerConfig = Object.assign(Object.assign({}, defaltStyle), config);
17
12
  let showAngleInfo = true;
18
13
  const showInfoAngleCallback = ({ show }) => {
19
14
  showAngleInfo = show;
@@ -26,8 +21,16 @@ export const MiddlewareInfo = (opts, config) => {
26
21
  disuse() {
27
22
  eventHub.off(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
28
23
  },
24
+ resetConfig(config) {
25
+ innerConfig = Object.assign(Object.assign({}, innerConfig), config);
26
+ },
29
27
  beforeDrawFrame({ snapshot }) {
30
28
  var _a;
29
+ const { textBackground, textColor } = innerConfig;
30
+ const style = {
31
+ textBackground,
32
+ textColor
33
+ };
31
34
  const { sharedStore } = snapshot;
32
35
  const selectedElementList = sharedStore[keySelectedElementList];
33
36
  const actionType = sharedStore[keyActionType];
@@ -7,9 +7,7 @@ export { keyLayoutIsSelected, keyLayoutIsBusyMoving };
7
7
  export const MiddlewareLayoutSelector = (opts, config) => {
8
8
  const { sharer, boardContent, calculator, viewer, eventHub } = opts;
9
9
  const { overlayContext } = boardContent;
10
- const innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
11
- const { activeColor } = innerConfig;
12
- const style = { activeColor };
10
+ let innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
13
11
  let prevPoint = null;
14
12
  let prevIsHoverContent = null;
15
13
  let prevIsSelected = null;
@@ -114,6 +112,9 @@ export const MiddlewareLayoutSelector = (opts, config) => {
114
112
  clear();
115
113
  resetController();
116
114
  },
115
+ resetConfig(config) {
116
+ innerConfig = Object.assign(Object.assign({}, innerConfig), config);
117
+ },
117
118
  hover: (e) => {
118
119
  if (sharer.getSharedStorage(keyLayoutIsBusyMoving) === true) {
119
120
  return;
@@ -312,6 +313,8 @@ export const MiddlewareLayoutSelector = (opts, config) => {
312
313
  if (isInElementAction()) {
313
314
  return;
314
315
  }
316
+ const { activeColor } = innerConfig;
317
+ const style = { activeColor };
315
318
  const { sharedStore, activeStore } = snapshot;
316
319
  const layoutActionType = sharedStore[keyLayoutActionType];
317
320
  const layoutIsHover = sharedStore[keyLayoutIsHoverContent];
@@ -5,17 +5,7 @@ import { coreEventKeys } from '../../config';
5
5
  export const MiddlewareRuler = (opts, config) => {
6
6
  const { boardContent, viewer, eventHub, calculator } = opts;
7
7
  const { overlayContext, underlayContext } = boardContent;
8
- const innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
9
- const { background, borderColor, scaleColor, textColor, gridColor, gridPrimaryColor, selectedAreaColor } = innerConfig;
10
- const style = {
11
- background,
12
- borderColor,
13
- scaleColor,
14
- textColor,
15
- gridColor,
16
- gridPrimaryColor,
17
- selectedAreaColor
18
- };
8
+ let innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
19
9
  let show = true;
20
10
  let showGrid = true;
21
11
  const rulerCallback = (e) => {
@@ -37,7 +27,20 @@ export const MiddlewareRuler = (opts, config) => {
37
27
  disuse() {
38
28
  eventHub.off(coreEventKeys.RULER, rulerCallback);
39
29
  },
30
+ resetConfig(config) {
31
+ innerConfig = Object.assign(Object.assign({}, innerConfig), config);
32
+ },
40
33
  beforeDrawFrame: ({ snapshot }) => {
34
+ const { background, borderColor, scaleColor, textColor, gridColor, gridPrimaryColor, selectedAreaColor } = innerConfig;
35
+ const style = {
36
+ background,
37
+ borderColor,
38
+ scaleColor,
39
+ textColor,
40
+ gridColor,
41
+ gridPrimaryColor,
42
+ selectedAreaColor
43
+ };
41
44
  if (show === true) {
42
45
  const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
43
46
  const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
@@ -1,5 +1,5 @@
1
- import type { ViewScaleInfo, ViewSizeInfo, ViewContext2D, BoardViewerFrameSnapshot, ViewCalculator } from '@idraw/types';
2
- import type { DeepRulerSharedStorage, MiddlewareRulerStyle } from './types';
1
+ import type { ViewScaleInfo, ViewSizeInfo, ViewContext2D, BoardViewerFrameSnapshot, ViewCalculator, MiddlewareRulerStyle } from '@idraw/types';
2
+ import type { DeepRulerSharedStorage } from './types';
3
3
  interface RulerScale {
4
4
  num: number;
5
5
  showNum: boolean;
@@ -152,13 +152,14 @@ export function drawRulerBackground(ctx, opts) {
152
152
  const { width, height } = viewSizeInfo;
153
153
  const { background, borderColor } = style;
154
154
  ctx.beginPath();
155
- ctx.moveTo(0, 0);
156
- ctx.lineTo(width + 1, 0);
155
+ const basePosition = -1;
156
+ ctx.moveTo(basePosition, basePosition);
157
+ ctx.lineTo(width + 1, basePosition);
157
158
  ctx.lineTo(width + 1, rulerSize);
158
159
  ctx.lineTo(rulerSize, rulerSize);
159
160
  ctx.lineTo(rulerSize, height + 1);
160
- ctx.lineTo(0, height + 1);
161
- ctx.lineTo(0, 0);
161
+ ctx.lineTo(basePosition, height + 1);
162
+ ctx.lineTo(basePosition, basePosition);
162
163
  ctx.closePath();
163
164
  ctx.fillStyle = background;
164
165
  ctx.fill();
@@ -7,16 +7,7 @@ export const MiddlewareScroller = (opts, config) => {
7
7
  sharer.setSharedStorage(keyXThumbRect, null);
8
8
  sharer.setSharedStorage(keyYThumbRect, null);
9
9
  let isBusy = false;
10
- const innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
11
- const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor, activeThumbBackground, activeThumbBorderColor } = innerConfig;
12
- const style = {
13
- thumbBackground,
14
- thumbBorderColor,
15
- hoverThumbBackground,
16
- hoverThumbBorderColor,
17
- activeThumbBackground,
18
- activeThumbBorderColor
19
- };
10
+ let innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
20
11
  const clear = () => {
21
12
  sharer.setSharedStorage(keyPrevPoint, null);
22
13
  sharer.setSharedStorage(keyActivePoint, null);
@@ -58,6 +49,9 @@ export const MiddlewareScroller = (opts, config) => {
58
49
  };
59
50
  return {
60
51
  name: '@middleware/scroller',
52
+ resetConfig(config) {
53
+ innerConfig = Object.assign(Object.assign({}, innerConfig), config);
54
+ },
61
55
  wheel: (e) => {
62
56
  viewer.scroll({
63
57
  moveX: 0 - e.deltaX,
@@ -122,6 +116,15 @@ export const MiddlewareScroller = (opts, config) => {
122
116
  }
123
117
  },
124
118
  beforeDrawFrame({ snapshot }) {
119
+ const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor, activeThumbBackground, activeThumbBorderColor } = innerConfig;
120
+ const style = {
121
+ thumbBackground,
122
+ thumbBorderColor,
123
+ hoverThumbBackground,
124
+ hoverThumbBorderColor,
125
+ activeThumbBackground,
126
+ activeThumbBorderColor
127
+ };
125
128
  const { xThumbRect, yThumbRect } = drawScroller(overlayContext, { snapshot, style });
126
129
  sharer.setSharedStorage(keyXThumbRect, xThumbRect);
127
130
  sharer.setSharedStorage(keyYThumbRect, yThumbRect);
@@ -10,9 +10,7 @@ import { createRotateControllerPattern } from './pattern';
10
10
  import { MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE } from '../info';
11
11
  export { keySelectedElementList, keyHoverElement, keyActionType, keyResizeType, keyGroupQueue };
12
12
  export const MiddlewareSelector = (opts, config) => {
13
- const innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
14
- const { activeColor, activeAreaColor, lockedColor, referenceColor } = innerConfig;
15
- const style = { activeColor, activeAreaColor, lockedColor, referenceColor };
13
+ let innerConfig = Object.assign(Object.assign({}, defaultStyle), config);
16
14
  const { viewer, sharer, boardContent, calculator, eventHub } = opts;
17
15
  const { overlayContext } = boardContent;
18
16
  let prevPoint = null;
@@ -20,8 +18,8 @@ export const MiddlewareSelector = (opts, config) => {
20
18
  let moveOriginalStartElementSize = null;
21
19
  let inBusyMode = null;
22
20
  let hasChangedData = null;
23
- const rotateControllerPattern = createRotateControllerPattern({
24
- fill: style.activeColor,
21
+ let rotateControllerPattern = createRotateControllerPattern({
22
+ fill: innerConfig.activeColor,
25
23
  devicePixelRatio: sharer.getActiveViewSizeInfo().devicePixelRatio
26
24
  });
27
25
  sharer.setSharedStorage(keyActionType, null);
@@ -171,6 +169,9 @@ export const MiddlewareSelector = (opts, config) => {
171
169
  eventHub.off(coreEventKeys.SELECT_IN_GROUP, selectInGroupCallback);
172
170
  eventHub.off(coreEventKeys.SNAP_TO_GRID, setSnapToSnapCallback);
173
171
  },
172
+ resetConfig(config) {
173
+ innerConfig = Object.assign(Object.assign({}, innerConfig), config);
174
+ },
174
175
  hover: (e) => {
175
176
  var _a, _b, _c, _d, _e;
176
177
  const layoutIsSelected = sharer.getSharedStorage(keyLayoutIsSelected);
@@ -682,8 +683,16 @@ export const MiddlewareSelector = (opts, config) => {
682
683
  },
683
684
  beforeDrawFrame({ snapshot }) {
684
685
  var _a;
686
+ const { activeColor, activeAreaColor, lockedColor, referenceColor } = innerConfig;
687
+ const style = { activeColor, activeAreaColor, lockedColor, referenceColor };
685
688
  const { activeStore, sharedStore } = snapshot;
686
689
  const { scale, offsetLeft, offsetTop, offsetRight, offsetBottom, width, height, contextHeight, contextWidth, devicePixelRatio } = activeStore;
690
+ if (rotateControllerPattern.fill !== activeColor) {
691
+ rotateControllerPattern = createRotateControllerPattern({
692
+ fill: innerConfig.activeColor,
693
+ devicePixelRatio
694
+ });
695
+ }
687
696
  const sharer = opts.sharer;
688
697
  const viewScaleInfo = { scale, offsetLeft, offsetTop, offsetRight, offsetBottom };
689
698
  const viewSizeInfo = { width, height, contextHeight, contextWidth, devicePixelRatio };
@@ -724,8 +733,7 @@ export const MiddlewareSelector = (opts, config) => {
724
733
  }
725
734
  }
726
735
  if (elem && ['select', 'drag', 'resize'].includes(actionType)) {
727
- drawSelectedElementControllersVertexes(overlayContext, selectedElementController, Object.assign(Object.assign({}, drawBaseOpts), { element: elem, calculator, hideControllers: !!isMoving && actionType === 'drag', rotateControllerPattern,
728
- style }));
736
+ drawSelectedElementControllersVertexes(overlayContext, selectedElementController, Object.assign(Object.assign({}, drawBaseOpts), { element: elem, calculator, hideControllers: !!isMoving && actionType === 'drag', rotateControllerPattern: rotateControllerPattern.context2d, style }));
729
737
  if (actionType === 'drag') {
730
738
  if (enableSnapToGrid === true) {
731
739
  const referenceInfo = calcReferenceInfo(elem.uuid, {
@@ -759,8 +767,7 @@ export const MiddlewareSelector = (opts, config) => {
759
767
  }
760
768
  }
761
769
  if (elem && ['select', 'drag', 'resize'].includes(actionType)) {
762
- drawSelectedElementControllersVertexes(overlayContext, selectedElementController, Object.assign(Object.assign({}, drawBaseOpts), { element: elem, calculator, hideControllers: !!isMoving && actionType === 'drag', rotateControllerPattern,
763
- style }));
770
+ drawSelectedElementControllersVertexes(overlayContext, selectedElementController, Object.assign(Object.assign({}, drawBaseOpts), { element: elem, calculator, hideControllers: !!isMoving && actionType === 'drag', rotateControllerPattern: rotateControllerPattern.context2d, style }));
764
771
  if (actionType === 'drag') {
765
772
  if (enableSnapToGrid === true) {
766
773
  const referenceInfo = calcReferenceInfo(elem.uuid, {
@@ -2,4 +2,7 @@ import type { ViewContext2D } from '@idraw/types';
2
2
  export declare function createRotateControllerPattern(opts: {
3
3
  fill: string;
4
4
  devicePixelRatio: number;
5
- }): ViewContext2D;
5
+ }): {
6
+ context2d: ViewContext2D;
7
+ fill: string;
8
+ };
@@ -34,5 +34,5 @@ export function createRotateControllerPattern(opts) {
34
34
  },
35
35
  parentOpacity: 1
36
36
  });
37
- return context2d;
37
+ return { context2d, fill };
38
38
  }
@@ -4281,6 +4281,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4281
4281
  __classPrivateFieldGet(this, _Board_instances, "m", _Board_resetActiveMiddlewareObjs).call(this);
4282
4282
  }
4283
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
+ }
4284
4293
  scale(opts) {
4285
4294
  const viewer = __classPrivateFieldGet(this, _Board_viewer, "f");
4286
4295
  const { ignoreUpdateVisibleStatus } = opts;
@@ -6018,12 +6027,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6018
6027
  const MiddlewareLayoutSelector = (opts, config) => {
6019
6028
  const { sharer, boardContent, calculator, viewer, eventHub } = opts;
6020
6029
  const { overlayContext } = boardContent;
6021
- const innerConfig = {
6030
+ let innerConfig = {
6022
6031
  ...defaultStyle$2,
6023
6032
  ...config
6024
6033
  };
6025
- const { activeColor: activeColor2 } = innerConfig;
6026
- const style = { activeColor: activeColor2 };
6027
6034
  let prevPoint = null;
6028
6035
  let prevIsHoverContent = null;
6029
6036
  let prevIsSelected = null;
@@ -6129,6 +6136,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6129
6136
  clear();
6130
6137
  resetController();
6131
6138
  },
6139
+ resetConfig(config2) {
6140
+ innerConfig = { ...innerConfig, ...config2 };
6141
+ },
6132
6142
  hover: (e) => {
6133
6143
  if (sharer.getSharedStorage(keyLayoutIsBusyMoving) === true) {
6134
6144
  return;
@@ -6311,6 +6321,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6311
6321
  if (isInElementAction()) {
6312
6322
  return;
6313
6323
  }
6324
+ const { activeColor: activeColor2 } = innerConfig;
6325
+ const style = { activeColor: activeColor2 };
6314
6326
  const { sharedStore, activeStore } = snapshot;
6315
6327
  const layoutActionType = sharedStore[keyLayoutActionType];
6316
6328
  const layoutIsHover = sharedStore[keyLayoutIsHoverContent];
@@ -6533,7 +6545,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6533
6545
  },
6534
6546
  parentOpacity: 1
6535
6547
  });
6536
- return context2d;
6548
+ return { context2d, fill };
6537
6549
  }
6538
6550
  const fontFamily$1 = "monospace";
6539
6551
  function drawSizeInfoText(ctx, opts) {
@@ -6659,15 +6671,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6659
6671
  const MiddlewareInfo = (opts, config) => {
6660
6672
  const { boardContent, calculator, eventHub } = opts;
6661
6673
  const { overlayContext } = boardContent;
6662
- const innerConfig = {
6674
+ let innerConfig = {
6663
6675
  ...defaltStyle,
6664
6676
  ...config
6665
6677
  };
6666
- const { textBackground, textColor: textColor2 } = innerConfig;
6667
- const style = {
6668
- textBackground,
6669
- textColor: textColor2
6670
- };
6671
6678
  let showAngleInfo = true;
6672
6679
  const showInfoAngleCallback = ({ show }) => {
6673
6680
  showAngleInfo = show;
@@ -6680,8 +6687,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6680
6687
  disuse() {
6681
6688
  eventHub.off(MIDDLEWARE_INTERNAL_EVENT_SHOW_INFO_ANGLE, showInfoAngleCallback);
6682
6689
  },
6690
+ resetConfig(config2) {
6691
+ innerConfig = { ...innerConfig, ...config2 };
6692
+ },
6683
6693
  beforeDrawFrame({ snapshot }) {
6684
6694
  var _a;
6695
+ const { textBackground, textColor: textColor2 } = innerConfig;
6696
+ const style = {
6697
+ textBackground,
6698
+ textColor: textColor2
6699
+ };
6685
6700
  const { sharedStore } = snapshot;
6686
6701
  const selectedElementList = sharedStore[keySelectedElementList];
6687
6702
  const actionType = sharedStore[keyActionType];
@@ -6781,12 +6796,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6781
6796
  };
6782
6797
  };
6783
6798
  const MiddlewareSelector = (opts, config) => {
6784
- const innerConfig = {
6799
+ let innerConfig = {
6785
6800
  ...defaultStyle$3,
6786
6801
  ...config
6787
6802
  };
6788
- const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
6789
- const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
6790
6803
  const { viewer, sharer, boardContent, calculator, eventHub } = opts;
6791
6804
  const { overlayContext } = boardContent;
6792
6805
  let prevPoint = null;
@@ -6794,8 +6807,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6794
6807
  let moveOriginalStartElementSize = null;
6795
6808
  let inBusyMode = null;
6796
6809
  let hasChangedData = null;
6797
- const rotateControllerPattern = createRotateControllerPattern({
6798
- fill: style.activeColor,
6810
+ let rotateControllerPattern = createRotateControllerPattern({
6811
+ fill: innerConfig.activeColor,
6799
6812
  devicePixelRatio: sharer.getActiveViewSizeInfo().devicePixelRatio
6800
6813
  });
6801
6814
  sharer.setSharedStorage(keyActionType, null);
@@ -6940,6 +6953,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
6940
6953
  eventHub.off(coreEventKeys.SELECT_IN_GROUP, selectInGroupCallback);
6941
6954
  eventHub.off(coreEventKeys.SNAP_TO_GRID, setSnapToSnapCallback);
6942
6955
  },
6956
+ resetConfig(config2) {
6957
+ innerConfig = { ...innerConfig, ...config2 };
6958
+ },
6943
6959
  hover: (e) => {
6944
6960
  var _a, _b, _c, _d, _e;
6945
6961
  const layoutIsSelected = sharer.getSharedStorage(keyLayoutIsSelected);
@@ -7432,8 +7448,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7432
7448
  },
7433
7449
  beforeDrawFrame({ snapshot }) {
7434
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 };
7435
7453
  const { activeStore, sharedStore } = snapshot;
7436
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
+ }
7437
7461
  const sharer2 = opts.sharer;
7438
7462
  const viewScaleInfo = { scale, offsetLeft, offsetTop, offsetRight, offsetBottom };
7439
7463
  const viewSizeInfo = { width, height, contextHeight, contextWidth, devicePixelRatio };
@@ -7482,7 +7506,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7482
7506
  element: elem,
7483
7507
  calculator,
7484
7508
  hideControllers: !!isMoving && actionType === "drag",
7485
- rotateControllerPattern,
7509
+ rotateControllerPattern: rotateControllerPattern.context2d,
7486
7510
  style
7487
7511
  });
7488
7512
  if (actionType === "drag") {
@@ -7525,7 +7549,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7525
7549
  element: elem,
7526
7550
  calculator,
7527
7551
  hideControllers: !!isMoving && actionType === "drag",
7528
- rotateControllerPattern,
7552
+ rotateControllerPattern: rotateControllerPattern.context2d,
7529
7553
  style
7530
7554
  });
7531
7555
  if (actionType === "drag") {
@@ -7778,19 +7802,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7778
7802
  sharer.setSharedStorage(keyXThumbRect, null);
7779
7803
  sharer.setSharedStorage(keyYThumbRect, null);
7780
7804
  let isBusy = false;
7781
- const innerConfig = {
7805
+ let innerConfig = {
7782
7806
  ...defaultStyle$1,
7783
7807
  ...config
7784
7808
  };
7785
- const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor, activeThumbBackground, activeThumbBorderColor } = innerConfig;
7786
- const style = {
7787
- thumbBackground,
7788
- thumbBorderColor,
7789
- hoverThumbBackground,
7790
- hoverThumbBorderColor,
7791
- activeThumbBackground,
7792
- activeThumbBorderColor
7793
- };
7794
7809
  const clear = () => {
7795
7810
  sharer.setSharedStorage(keyPrevPoint$1, null);
7796
7811
  sharer.setSharedStorage(keyActivePoint, null);
@@ -7832,6 +7847,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7832
7847
  };
7833
7848
  return {
7834
7849
  name: "@middleware/scroller",
7850
+ resetConfig(config2) {
7851
+ innerConfig = { ...innerConfig, ...config2 };
7852
+ },
7835
7853
  wheel: (e) => {
7836
7854
  viewer.scroll({
7837
7855
  moveX: 0 - e.deltaX,
@@ -7894,6 +7912,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
7894
7912
  }
7895
7913
  },
7896
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
+ };
7897
7924
  const { xThumbRect, yThumbRect } = drawScroller(overlayContext, { snapshot, style });
7898
7925
  sharer.setSharedStorage(keyXThumbRect, xThumbRect);
7899
7926
  sharer.setSharedStorage(keyYThumbRect, yThumbRect);
@@ -8098,13 +8125,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
8098
8125
  const { width, height } = viewSizeInfo;
8099
8126
  const { background: background2, borderColor: borderColor2 } = style;
8100
8127
  ctx.beginPath();
8101
- ctx.moveTo(0, 0);
8102
- ctx.lineTo(width + 1, 0);
8128
+ const basePosition = -1;
8129
+ ctx.moveTo(basePosition, basePosition);
8130
+ ctx.lineTo(width + 1, basePosition);
8103
8131
  ctx.lineTo(width + 1, rulerSize);
8104
8132
  ctx.lineTo(rulerSize, rulerSize);
8105
8133
  ctx.lineTo(rulerSize, height + 1);
8106
- ctx.lineTo(0, height + 1);
8107
- ctx.lineTo(0, 0);
8134
+ ctx.lineTo(basePosition, height + 1);
8135
+ ctx.lineTo(basePosition, basePosition);
8108
8136
  ctx.closePath();
8109
8137
  ctx.fillStyle = background2;
8110
8138
  ctx.fill();
@@ -8203,20 +8231,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
8203
8231
  const MiddlewareRuler = (opts, config) => {
8204
8232
  const { boardContent, viewer, eventHub, calculator } = opts;
8205
8233
  const { overlayContext, underlayContext } = boardContent;
8206
- const innerConfig = {
8234
+ let innerConfig = {
8207
8235
  ...defaultStyle,
8208
8236
  ...config
8209
8237
  };
8210
- const { background: background2, borderColor: borderColor2, scaleColor: scaleColor2, textColor: textColor2, gridColor: gridColor2, gridPrimaryColor: gridPrimaryColor2, selectedAreaColor: selectedAreaColor2 } = innerConfig;
8211
- const style = {
8212
- background: background2,
8213
- borderColor: borderColor2,
8214
- scaleColor: scaleColor2,
8215
- textColor: textColor2,
8216
- gridColor: gridColor2,
8217
- gridPrimaryColor: gridPrimaryColor2,
8218
- selectedAreaColor: selectedAreaColor2
8219
- };
8220
8238
  let show = true;
8221
8239
  let showGrid = true;
8222
8240
  const rulerCallback = (e) => {
@@ -8238,7 +8256,20 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
8238
8256
  disuse() {
8239
8257
  eventHub.off(coreEventKeys.RULER, rulerCallback);
8240
8258
  },
8259
+ resetConfig(config2) {
8260
+ innerConfig = { ...innerConfig, ...config2 };
8261
+ },
8241
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
+ };
8242
8273
  if (show === true) {
8243
8274
  const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
8244
8275
  const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
@@ -8612,6 +8643,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
8612
8643
  disuse(middleware) {
8613
8644
  __privateGet(this, _board).disuse(middleware);
8614
8645
  }
8646
+ resetMiddlewareConfig(middleware, config) {
8647
+ __privateGet(this, _board).resetMiddlewareConfig(middleware, config);
8648
+ }
8615
8649
  setData(data, opts) {
8616
8650
  validateElements((data == null ? void 0 : data.elements) || []);
8617
8651
  __privateGet(this, _board).setData(data, opts);