@idraw/core 0.4.0-beta.30 → 0.4.0-beta.32

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 (39) hide show
  1. package/dist/esm/index.d.ts +2 -2
  2. package/dist/esm/index.js +2 -2
  3. package/dist/esm/middleware/info/config.d.ts +4 -0
  4. package/dist/esm/middleware/info/config.js +8 -0
  5. package/dist/esm/middleware/info/draw-info.d.ts +4 -6
  6. package/dist/esm/middleware/info/draw-info.js +12 -9
  7. package/dist/esm/middleware/info/index.d.ts +2 -2
  8. package/dist/esm/middleware/info/index.js +11 -9
  9. package/dist/esm/middleware/layout-selector/config.d.ts +2 -2
  10. package/dist/esm/middleware/layout-selector/config.js +3 -2
  11. package/dist/esm/middleware/layout-selector/index.d.ts +2 -2
  12. package/dist/esm/middleware/layout-selector/index.js +7 -4
  13. package/dist/esm/middleware/layout-selector/util.d.ts +3 -2
  14. package/dist/esm/middleware/layout-selector/util.js +19 -64
  15. package/dist/esm/middleware/ruler/config.d.ts +7 -0
  16. package/dist/esm/middleware/ruler/config.js +21 -0
  17. package/dist/esm/middleware/ruler/index.d.ts +2 -2
  18. package/dist/esm/middleware/ruler/index.js +19 -6
  19. package/dist/esm/middleware/ruler/util.d.ts +6 -1
  20. package/dist/esm/middleware/ruler/util.js +13 -19
  21. package/dist/esm/middleware/scroller/config.d.ts +2 -0
  22. package/dist/esm/middleware/scroller/config.js +8 -0
  23. package/dist/esm/middleware/scroller/index.d.ts +2 -2
  24. package/dist/esm/middleware/scroller/index.js +13 -3
  25. package/dist/esm/middleware/scroller/util.d.ts +2 -1
  26. package/dist/esm/middleware/scroller/util.js +19 -36
  27. package/dist/esm/middleware/selector/config.d.ts +2 -4
  28. package/dist/esm/middleware/selector/config.js +10 -4
  29. package/dist/esm/middleware/selector/draw-auxiliary.d.ts +1 -7
  30. package/dist/esm/middleware/selector/draw-auxiliary.js +1 -35
  31. package/dist/esm/middleware/selector/draw-reference.d.ts +2 -0
  32. package/dist/esm/middleware/selector/draw-reference.js +2 -2
  33. package/dist/esm/middleware/selector/draw-wrapper.d.ts +7 -1
  34. package/dist/esm/middleware/selector/draw-wrapper.js +22 -13
  35. package/dist/esm/middleware/selector/index.d.ts +2 -2
  36. package/dist/esm/middleware/selector/index.js +16 -12
  37. package/dist/index.global.js +224 -169
  38. package/dist/index.global.min.js +1 -1
  39. package/package.json +5 -5
@@ -4205,7 +4205,7 @@ var __privateMethod = (obj, member, method) => {
4205
4205
  const { data } = __classPrivateFieldGet(this, _Board_sharer, "f").getActiveStoreSnapshot();
4206
4206
  return data;
4207
4207
  }
4208
- use(middleware) {
4208
+ use(middleware, config) {
4209
4209
  var _a, _b, _c;
4210
4210
  if (__classPrivateFieldGet(this, _Board_middlewareMap, "f").has(middleware)) {
4211
4211
  const item = __classPrivateFieldGet(this, _Board_middlewareMap, "f").get(middleware);
@@ -4222,13 +4222,14 @@ var __privateMethod = (obj, member, method) => {
4222
4222
  const viewer = __classPrivateFieldGet(this, _Board_viewer, "f");
4223
4223
  const calculator = __classPrivateFieldGet(this, _Board_calculator, "f");
4224
4224
  const eventHub = __classPrivateFieldGet(this, _Board_eventHub, "f");
4225
- const obj = middleware({ boardContent, sharer, viewer, calculator, eventHub, container });
4225
+ const obj = middleware({ boardContent, sharer, viewer, calculator, eventHub, container }, config);
4226
4226
  (_c = obj.use) === null || _c === void 0 ? void 0 : _c.call(obj);
4227
4227
  __classPrivateFieldGet(this, _Board_middlewares, "f").push(middleware);
4228
4228
  __classPrivateFieldGet(this, _Board_activeMiddlewareObjs, "f").push(obj);
4229
4229
  __classPrivateFieldGet(this, _Board_middlewareMap, "f").set(middleware, {
4230
4230
  status: "enable",
4231
- middlewareObject: obj
4231
+ middlewareObject: obj,
4232
+ config
4232
4233
  });
4233
4234
  __classPrivateFieldGet(this, _Board_instances, "m", _Board_resetActiveMiddlewareObjs).call(this);
4234
4235
  }
@@ -4597,10 +4598,17 @@ var __privateMethod = (obj, member, method) => {
4597
4598
  const selectWrapperBorderWidth = 2;
4598
4599
  const resizeControllerBorderWidth = 4;
4599
4600
  const areaBorderWidth = 1;
4600
- const wrapperColor = "#1973ba";
4601
- const lockColor = "#5b5959b5";
4602
4601
  const controllerSize$1 = 10;
4602
+ const activeColor = "#1973ba";
4603
+ const activeAreaColor = "#1976d21c";
4604
+ const lockedColor = "#5b5959b5";
4603
4605
  const referenceColor = "#f7276e";
4606
+ const defaultStyle$3 = {
4607
+ activeColor,
4608
+ activeAreaColor,
4609
+ lockedColor,
4610
+ referenceColor
4611
+ };
4604
4612
  const middlewareEventSelect = "@middleware/select";
4605
4613
  const middlewareEventSelectClear = "@middleware/select-clear";
4606
4614
  const middlewareEventSelectInGroup = "@middleware/select-in-group";
@@ -4709,19 +4717,23 @@ var __privateMethod = (obj, member, method) => {
4709
4717
  if (!vertexes) {
4710
4718
  return;
4711
4719
  }
4712
- const wrapperOpts = { borderColor: wrapperColor, borderWidth: 1, background: "transparent", lineDash: [] };
4720
+ const { style } = opts;
4721
+ const { activeColor: activeColor2 } = style;
4722
+ const wrapperOpts = { borderColor: activeColor2, borderWidth: 1, background: "transparent", lineDash: [] };
4713
4723
  drawVertexes(ctx, calcViewVertexes(vertexes, opts), wrapperOpts);
4714
4724
  }
4715
4725
  function drawLockVertexesWrapper(ctx, vertexes, opts) {
4716
4726
  if (!vertexes) {
4717
4727
  return;
4718
4728
  }
4719
- const wrapperOpts = { borderColor: lockColor, borderWidth: 1, background: "transparent", lineDash: [] };
4729
+ const { style } = opts;
4730
+ const { lockedColor: lockedColor2 } = style;
4731
+ const wrapperOpts = { borderColor: lockedColor2, borderWidth: 1, background: "transparent", lineDash: [] };
4720
4732
  drawVertexes(ctx, calcViewVertexes(vertexes, opts), wrapperOpts);
4721
4733
  const { controller } = opts;
4722
4734
  if (controller) {
4723
4735
  const { topLeft, topRight, bottomLeft, bottomRight, topMiddle, bottomMiddle, leftMiddle, rightMiddle } = controller;
4724
- const ctrlOpts = { ...wrapperOpts, borderWidth: 1, background: lockColor };
4736
+ const ctrlOpts = { ...wrapperOpts, borderWidth: 1, background: lockedColor2 };
4725
4737
  drawCrossVertexes(ctx, calcViewVertexes(topMiddle.vertexes, opts), ctrlOpts);
4726
4738
  drawCrossVertexes(ctx, calcViewVertexes(bottomMiddle.vertexes, opts), ctrlOpts);
4727
4739
  drawCrossVertexes(ctx, calcViewVertexes(leftMiddle.vertexes, opts), ctrlOpts);
@@ -4737,11 +4749,13 @@ var __privateMethod = (obj, member, method) => {
4737
4749
  return;
4738
4750
  }
4739
4751
  const {
4740
- hideControllers
4752
+ hideControllers,
4753
+ style
4741
4754
  // calculator, element, viewScaleInfo, viewSizeInfo
4742
4755
  } = opts;
4756
+ const { activeColor: activeColor2 } = style;
4743
4757
  const { elementWrapper, topLeft, topRight, bottomLeft, bottomRight, top, rotate } = controller;
4744
- const wrapperOpts = { borderColor: wrapperColor, borderWidth: selectWrapperBorderWidth, background: "transparent", lineDash: [] };
4758
+ const wrapperOpts = { borderColor: activeColor2, borderWidth: selectWrapperBorderWidth, background: "transparent", lineDash: [] };
4745
4759
  const ctrlOpts = { ...wrapperOpts, borderWidth: resizeControllerBorderWidth, background: "#FFFFFF" };
4746
4760
  drawVertexes(ctx, calcViewVertexes(elementWrapper, opts), wrapperOpts);
4747
4761
  if (!hideControllers) {
@@ -4754,11 +4768,12 @@ var __privateMethod = (obj, member, method) => {
4754
4768
  }
4755
4769
  }
4756
4770
  function drawArea(ctx, opts) {
4757
- const { start, end } = opts;
4771
+ const { start, end, style } = opts;
4772
+ const { activeColor: activeColor2, activeAreaColor: activeAreaColor2 } = style;
4758
4773
  ctx.setLineDash([]);
4759
4774
  ctx.lineWidth = areaBorderWidth;
4760
- ctx.strokeStyle = wrapperColor;
4761
- ctx.fillStyle = "#1976d24f";
4775
+ ctx.strokeStyle = activeColor2;
4776
+ ctx.fillStyle = activeAreaColor2;
4762
4777
  ctx.beginPath();
4763
4778
  ctx.moveTo(start.x, start.y);
4764
4779
  ctx.lineTo(end.x, start.y);
@@ -4769,12 +4784,13 @@ var __privateMethod = (obj, member, method) => {
4769
4784
  ctx.fill();
4770
4785
  }
4771
4786
  function drawListArea(ctx, opts) {
4772
- const { areaSize } = opts;
4787
+ const { areaSize, style } = opts;
4788
+ const { activeColor: activeColor2, activeAreaColor: activeAreaColor2 } = style;
4773
4789
  const { x: x2, y: y2, w: w2, h: h2 } = areaSize;
4774
4790
  ctx.setLineDash([]);
4775
4791
  ctx.lineWidth = areaBorderWidth;
4776
- ctx.strokeStyle = wrapperColor;
4777
- ctx.fillStyle = "#1976d21c";
4792
+ ctx.strokeStyle = activeColor2;
4793
+ ctx.fillStyle = activeAreaColor2;
4778
4794
  ctx.beginPath();
4779
4795
  ctx.moveTo(x2, y2);
4780
4796
  ctx.lineTo(x2 + w2, y2);
@@ -4785,16 +4801,19 @@ var __privateMethod = (obj, member, method) => {
4785
4801
  ctx.fill();
4786
4802
  }
4787
4803
  function drawGroupQueueVertexesWrappers(ctx, vertexesList, opts) {
4804
+ const { style } = opts;
4805
+ const { activeColor: activeColor2 } = style;
4788
4806
  for (let i = 0; i < vertexesList.length; i++) {
4789
4807
  const vertexes = vertexesList[i];
4790
- const wrapperOpts = { borderColor: wrapperColor, borderWidth: selectWrapperBorderWidth, background: "transparent", lineDash: [4, 4] };
4808
+ const wrapperOpts = { borderColor: activeColor2, borderWidth: selectWrapperBorderWidth, background: "transparent", lineDash: [4, 4] };
4791
4809
  drawVertexes(ctx, calcViewVertexes(vertexes, opts), wrapperOpts);
4792
4810
  }
4793
4811
  }
4794
4812
  function drawReferenceLines(ctx, opts) {
4795
- const { xLines, yLines } = opts;
4813
+ const { xLines, yLines, style } = opts;
4814
+ const { referenceColor: referenceColor2 } = style;
4796
4815
  const lineOpts = {
4797
- borderColor: referenceColor,
4816
+ borderColor: referenceColor2,
4798
4817
  borderWidth: 1,
4799
4818
  lineDash: []
4800
4819
  };
@@ -6076,10 +6095,12 @@ var __privateMethod = (obj, member, method) => {
6076
6095
  const keyLayoutController = Symbol(`${key$2}_layoutController`);
6077
6096
  const keyLayoutIsHover = Symbol(`${key$2}_layoutIsHover`);
6078
6097
  const keyLayoutIsSelected = Symbol(`${key$2}_layoutIsSelected`);
6079
- const selectColor = "#b331c9";
6080
- const disableColor = "#5b5959b5";
6081
6098
  const controllerSize = 10;
6082
- function drawControllerBox(ctx, boxVertexes) {
6099
+ const defaultStyle$2 = {
6100
+ activeColor: "#b331c9"
6101
+ };
6102
+ function drawControllerBox(ctx, boxVertexes, style) {
6103
+ const { activeColor: activeColor2 } = style;
6083
6104
  ctx.setLineDash([]);
6084
6105
  ctx.fillStyle = "#FFFFFF";
6085
6106
  ctx.beginPath();
@@ -6089,7 +6110,7 @@ var __privateMethod = (obj, member, method) => {
6089
6110
  ctx.lineTo(boxVertexes[3].x, boxVertexes[3].y);
6090
6111
  ctx.closePath();
6091
6112
  ctx.fill();
6092
- ctx.strokeStyle = selectColor;
6113
+ ctx.strokeStyle = activeColor2;
6093
6114
  ctx.lineWidth = 2;
6094
6115
  ctx.beginPath();
6095
6116
  ctx.moveTo(boxVertexes[0].x, boxVertexes[0].y);
@@ -6099,26 +6120,11 @@ var __privateMethod = (obj, member, method) => {
6099
6120
  ctx.closePath();
6100
6121
  ctx.stroke();
6101
6122
  }
6102
- function drawControllerCross(ctx, opts) {
6103
- const { vertexes, strokeStyle, lineWidth } = opts;
6104
- ctx.setLineDash([]);
6105
- ctx.strokeStyle = strokeStyle;
6106
- ctx.lineWidth = lineWidth;
6107
- ctx.beginPath();
6108
- ctx.moveTo(vertexes[0].x, vertexes[0].y);
6109
- ctx.lineTo(vertexes[2].x, vertexes[2].y);
6110
- ctx.closePath();
6111
- ctx.stroke();
6112
- ctx.beginPath();
6113
- ctx.moveTo(vertexes[1].x, vertexes[1].y);
6114
- ctx.lineTo(vertexes[3].x, vertexes[3].y);
6115
- ctx.closePath();
6116
- ctx.stroke();
6117
- }
6118
6123
  function drawControllerLine(ctx, opts) {
6119
- const { start, end, centerVertexes, disabled } = opts;
6120
- const lineWidth = disabled === true ? 1 : 2;
6121
- const strokeStyle = disabled === true ? disableColor : selectColor;
6124
+ const { start, end, style } = opts;
6125
+ const { activeColor: activeColor2 } = style;
6126
+ const lineWidth = 2;
6127
+ const strokeStyle = activeColor2;
6122
6128
  ctx.setLineDash([]);
6123
6129
  ctx.strokeStyle = strokeStyle;
6124
6130
  ctx.lineWidth = lineWidth;
@@ -6127,51 +6133,25 @@ var __privateMethod = (obj, member, method) => {
6127
6133
  ctx.lineTo(end.x, end.y);
6128
6134
  ctx.closePath();
6129
6135
  ctx.stroke();
6130
- if (disabled === true) {
6131
- drawControllerCross(ctx, {
6132
- vertexes: centerVertexes,
6133
- lineWidth,
6134
- strokeStyle
6135
- });
6136
- }
6137
6136
  }
6138
6137
  function drawLayoutController(ctx, opts) {
6139
- const { controller, operations } = opts;
6138
+ const { controller, style } = opts;
6140
6139
  const { topLeft, topRight, bottomLeft, bottomRight, topMiddle, rightMiddle, bottomMiddle, leftMiddle } = controller;
6141
- drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.disabledTop) });
6142
- drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.disabledRight) });
6143
- drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.disabledBottom) });
6144
- drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, disabled: !!(operations == null ? void 0 : operations.disabledLeft) });
6145
- const disabledOpts = {
6146
- lineWidth: 1,
6147
- strokeStyle: disableColor
6148
- };
6149
- if ((operations == null ? void 0 : operations.disabledTopLeft) === true) {
6150
- drawControllerCross(ctx, { vertexes: topLeft.vertexes, ...disabledOpts });
6151
- } else {
6152
- drawControllerBox(ctx, topLeft.vertexes);
6153
- }
6154
- if ((operations == null ? void 0 : operations.disabledTopRight) === true) {
6155
- drawControllerCross(ctx, { vertexes: topRight.vertexes, ...disabledOpts });
6156
- } else {
6157
- drawControllerBox(ctx, topRight.vertexes);
6158
- }
6159
- if ((operations == null ? void 0 : operations.disabledBottomRight) === true) {
6160
- drawControllerCross(ctx, { vertexes: bottomRight.vertexes, ...disabledOpts });
6161
- } else {
6162
- drawControllerBox(ctx, bottomRight.vertexes);
6163
- }
6164
- if ((operations == null ? void 0 : operations.disabledBottomLeft) === true) {
6165
- drawControllerCross(ctx, { vertexes: bottomLeft.vertexes, ...disabledOpts });
6166
- } else {
6167
- drawControllerBox(ctx, bottomLeft.vertexes);
6168
- }
6140
+ drawControllerLine(ctx, { start: topLeft.center, end: topRight.center, centerVertexes: topMiddle.vertexes, style });
6141
+ drawControllerLine(ctx, { start: topRight.center, end: bottomRight.center, centerVertexes: rightMiddle.vertexes, style });
6142
+ drawControllerLine(ctx, { start: bottomRight.center, end: bottomLeft.center, centerVertexes: bottomMiddle.vertexes, style });
6143
+ drawControllerLine(ctx, { start: bottomLeft.center, end: topLeft.center, centerVertexes: leftMiddle.vertexes, style });
6144
+ drawControllerBox(ctx, topLeft.vertexes, style);
6145
+ drawControllerBox(ctx, topRight.vertexes, style);
6146
+ drawControllerBox(ctx, bottomRight.vertexes, style);
6147
+ drawControllerBox(ctx, bottomLeft.vertexes, style);
6169
6148
  }
6170
6149
  function drawLayoutHover(ctx, opts) {
6171
- const { layoutSize } = opts;
6150
+ const { layoutSize, style } = opts;
6151
+ const { activeColor: activeColor2 } = style;
6172
6152
  const { x: x2, y: y2, w: w2, h: h2 } = layoutSize;
6173
6153
  ctx.setLineDash([]);
6174
- ctx.strokeStyle = selectColor;
6154
+ ctx.strokeStyle = activeColor2;
6175
6155
  ctx.lineWidth = 1;
6176
6156
  ctx.beginPath();
6177
6157
  ctx.moveTo(x2, y2);
@@ -6182,9 +6162,15 @@ var __privateMethod = (obj, member, method) => {
6182
6162
  ctx.closePath();
6183
6163
  ctx.stroke();
6184
6164
  }
6185
- const MiddlewareLayoutSelector = (opts) => {
6165
+ const MiddlewareLayoutSelector = (opts, config) => {
6186
6166
  const { sharer, boardContent, calculator, viewer, eventHub } = opts;
6187
6167
  const { overlayContext } = boardContent;
6168
+ const innerConfig = {
6169
+ ...defaultStyle$2,
6170
+ ...config
6171
+ };
6172
+ const { activeColor: activeColor2 } = innerConfig;
6173
+ const style = { activeColor: activeColor2 };
6188
6174
  let prevPoint = null;
6189
6175
  let prevIsHover = null;
6190
6176
  let prevIsSelected = null;
@@ -6476,10 +6462,10 @@ var __privateMethod = (obj, member, method) => {
6476
6462
  const controller = calcLayoutSizeController(size, { viewScaleInfo, controllerSize });
6477
6463
  if (layoutIsHover === true) {
6478
6464
  const viewSize = calcViewElementSize(size, { viewScaleInfo });
6479
- drawLayoutHover(overlayContext, { layoutSize: viewSize });
6465
+ drawLayoutHover(overlayContext, { layoutSize: viewSize, style });
6480
6466
  }
6481
6467
  if (layoutActionType && ["resize"].includes(layoutActionType) || layoutIsSelected === true) {
6482
- drawLayoutController(overlayContext, { controller, operations: activeStore.data.layout.operations || {} });
6468
+ drawLayoutController(overlayContext, { controller, style });
6483
6469
  }
6484
6470
  }
6485
6471
  },
@@ -6494,7 +6480,13 @@ var __privateMethod = (obj, member, method) => {
6494
6480
  }
6495
6481
  };
6496
6482
  };
6497
- const MiddlewareSelector = (opts) => {
6483
+ const MiddlewareSelector = (opts, config) => {
6484
+ const innerConfig = {
6485
+ ...defaultStyle$3,
6486
+ ...config
6487
+ };
6488
+ const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
6489
+ const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
6498
6490
  const { viewer, sharer, boardContent, calculator, eventHub } = opts;
6499
6491
  const { overlayContext } = boardContent;
6500
6492
  let prevPoint = null;
@@ -6580,7 +6572,6 @@ var __privateMethod = (obj, member, method) => {
6580
6572
  sharer.setSharedStorage(keySelectedElementController, null);
6581
6573
  sharer.setSharedStorage(keySelectedElementPosition, []);
6582
6574
  sharer.setSharedStorage(keyIsMoving, null);
6583
- sharer.setSharedStorage(keyEnableSelectInGroup, null);
6584
6575
  };
6585
6576
  clear();
6586
6577
  const selectCallback = ({ uuids, positions }) => {
@@ -7066,7 +7057,7 @@ var __privateMethod = (obj, member, method) => {
7066
7057
  const groupQueueVertexesList = sharedStore[keyGroupQueueVertexesList];
7067
7058
  const isMoving = sharedStore[keyIsMoving];
7068
7059
  const enableSnapToGrid = sharedStore[keyEnableSnapToGrid];
7069
- const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo };
7060
+ const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo, style };
7070
7061
  const selectedElementController = elem ? calcElementSizeController(elem, {
7071
7062
  groupQueue,
7072
7063
  controllerSize: 10,
@@ -7083,7 +7074,8 @@ var __privateMethod = (obj, member, method) => {
7083
7074
  groupQueue,
7084
7075
  controllerSize: 10,
7085
7076
  viewScaleInfo
7086
- })
7077
+ }),
7078
+ style
7087
7079
  });
7088
7080
  } else {
7089
7081
  drawHoverVertexesWrapper(overlayContext, hoverElementVertexes, drawBaseOpts);
@@ -7094,7 +7086,8 @@ var __privateMethod = (obj, member, method) => {
7094
7086
  ...drawBaseOpts,
7095
7087
  element: elem,
7096
7088
  calculator,
7097
- hideControllers: !!isMoving && actionType === "drag"
7089
+ hideControllers: !!isMoving && actionType === "drag",
7090
+ style
7098
7091
  });
7099
7092
  if (actionType === "drag") {
7100
7093
  if (enableSnapToGrid === true) {
@@ -7110,7 +7103,8 @@ var __privateMethod = (obj, member, method) => {
7110
7103
  if (offsetX === 0 || offsetY === 0) {
7111
7104
  drawReferenceLines(overlayContext, {
7112
7105
  xLines,
7113
- yLines
7106
+ yLines,
7107
+ style
7114
7108
  });
7115
7109
  }
7116
7110
  }
@@ -7126,7 +7120,8 @@ var __privateMethod = (obj, member, method) => {
7126
7120
  groupQueue,
7127
7121
  controllerSize: 10,
7128
7122
  viewScaleInfo
7129
- })
7123
+ }),
7124
+ style
7130
7125
  });
7131
7126
  } else {
7132
7127
  drawHoverVertexesWrapper(overlayContext, hoverElementVertexes, drawBaseOpts);
@@ -7137,7 +7132,8 @@ var __privateMethod = (obj, member, method) => {
7137
7132
  ...drawBaseOpts,
7138
7133
  element: elem,
7139
7134
  calculator,
7140
- hideControllers: !!isMoving && actionType === "drag"
7135
+ hideControllers: !!isMoving && actionType === "drag",
7136
+ style
7141
7137
  });
7142
7138
  if (actionType === "drag") {
7143
7139
  if (enableSnapToGrid === true) {
@@ -7153,14 +7149,15 @@ var __privateMethod = (obj, member, method) => {
7153
7149
  if (offsetX === 0 || offsetY === 0) {
7154
7150
  drawReferenceLines(overlayContext, {
7155
7151
  xLines,
7156
- yLines
7152
+ yLines,
7153
+ style
7157
7154
  });
7158
7155
  }
7159
7156
  }
7160
7157
  }
7161
7158
  }
7162
7159
  } else if (actionType === "area" && areaStart && areaEnd) {
7163
- drawArea(overlayContext, { start: areaStart, end: areaEnd });
7160
+ drawArea(overlayContext, { start: areaStart, end: areaEnd, style });
7164
7161
  } else if (["drag-list", "drag-list-end"].includes(actionType)) {
7165
7162
  const listAreaSize = calcSelectedElementsArea(getActiveElements(), {
7166
7163
  viewScaleInfo: sharer2.getActiveViewScaleInfo(),
@@ -7168,7 +7165,7 @@ var __privateMethod = (obj, member, method) => {
7168
7165
  calculator
7169
7166
  });
7170
7167
  if (listAreaSize) {
7171
- drawListArea(overlayContext, { areaSize: listAreaSize });
7168
+ drawListArea(overlayContext, { areaSize: listAreaSize, style });
7172
7169
  }
7173
7170
  }
7174
7171
  }
@@ -7183,16 +7180,16 @@ var __privateMethod = (obj, member, method) => {
7183
7180
  const keyPrevPoint$1 = Symbol(`${key$1}_prevPoint`);
7184
7181
  const keyActivePoint = Symbol(`${key$1}_activePoint`);
7185
7182
  const keyActiveThumbType = Symbol(`${key$1}_activeThumbType`);
7186
- const minScrollerWidth = 12;
7187
- const scrollerLineWidth = 16;
7188
- const scrollerThumbAlpha = 0.3;
7189
- const scrollConfig = {
7190
- width: minScrollerWidth,
7191
- thumbColor: "#0000008A",
7192
- thumbHoverColor: "#000000EE",
7193
- scrollBarColor: "#FFFFFF60",
7194
- showScrollBar: false
7183
+ const defaultStyle$1 = {
7184
+ thumbBackground: "#0000003A",
7185
+ thumbBorderColor: "#0000008A",
7186
+ hoverThumbBackground: "#0000005F",
7187
+ hoverThumbBorderColor: "#000000EE",
7188
+ activeThumbBackground: "#0000005E",
7189
+ activeThumbBorderColor: "#000000F0"
7195
7190
  };
7191
+ const scrollerLineWidth = 16;
7192
+ const minThumbLength = scrollerLineWidth * 2.5;
7196
7193
  function isPointAtRect(overlayContext, p, rect) {
7197
7194
  const ctx = overlayContext;
7198
7195
  const { x: x2, y: y2, w: w2, h: h2 } = rect;
@@ -7228,11 +7225,12 @@ var __privateMethod = (obj, member, method) => {
7228
7225
  return info;
7229
7226
  }
7230
7227
  function calcScrollerInfo(opts) {
7231
- const { viewScaleInfo, viewSizeInfo, hoverXThumb, hoverYThumb } = opts;
7228
+ const { viewScaleInfo, viewSizeInfo, hoverXThumb, hoverYThumb, style } = opts;
7232
7229
  const { width, height } = viewSizeInfo;
7233
7230
  const { offsetTop, offsetBottom, offsetLeft, offsetRight } = viewScaleInfo;
7234
- const sliderMinSize = scrollerLineWidth * 2.5;
7231
+ const sliderMinSize = minThumbLength;
7235
7232
  const lineSize2 = scrollerLineWidth;
7233
+ const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor } = style;
7236
7234
  let xSize = 0;
7237
7235
  let ySize = 0;
7238
7236
  xSize = Math.max(sliderMinSize, width - lineSize2 * 2 - (Math.abs(offsetLeft) + Math.abs(offsetRight)));
@@ -7283,23 +7281,25 @@ var __privateMethod = (obj, member, method) => {
7283
7281
  ySize,
7284
7282
  translateY,
7285
7283
  translateX,
7286
- xThumbColor: hoverXThumb ? scrollConfig.thumbHoverColor : scrollConfig.thumbColor,
7287
- yThumbColor: hoverYThumb ? scrollConfig.thumbHoverColor : scrollConfig.thumbColor,
7288
- scrollBarColor: scrollConfig.scrollBarColor,
7284
+ xThumbBackground: hoverXThumb ? hoverThumbBackground : thumbBackground,
7285
+ yThumbBackground: hoverYThumb ? hoverThumbBackground : thumbBackground,
7286
+ xThumbBorderColor: hoverXThumb ? hoverThumbBorderColor : thumbBorderColor,
7287
+ yThumbBorderColor: hoverYThumb ? hoverThumbBorderColor : thumbBorderColor,
7288
+ // scrollBarColor: scrollConfig.scrollBarColor,
7289
7289
  xThumbRect,
7290
7290
  yThumbRect
7291
7291
  };
7292
7292
  return scrollWrapper;
7293
7293
  }
7294
7294
  function drawScrollerThumb(ctx, opts) {
7295
- let { x: x2, y: y2, h: h2, w: w2 } = opts;
7295
+ let { x: x2, y: y2, h: h2, w: w2, background: background2, borderColor: borderColor2 } = opts;
7296
7296
  ctx.save();
7297
7297
  ctx.shadowColor = "#FFFFFF";
7298
7298
  ctx.shadowOffsetX = 0;
7299
7299
  ctx.shadowOffsetY = 0;
7300
7300
  ctx.shadowBlur = 1;
7301
7301
  {
7302
- const { color: color2, axis } = opts;
7302
+ const { axis } = opts;
7303
7303
  if (axis === "X") {
7304
7304
  y2 = y2 + h2 / 4 + 0;
7305
7305
  h2 = h2 / 2;
@@ -7312,7 +7312,7 @@ var __privateMethod = (obj, member, method) => {
7312
7312
  if (w2 < r * 2 || h2 < r * 2) {
7313
7313
  r = 0;
7314
7314
  }
7315
- ctx.globalAlpha = scrollerThumbAlpha;
7315
+ ctx.globalAlpha = 1;
7316
7316
  ctx.beginPath();
7317
7317
  ctx.moveTo(x2 + r, y2);
7318
7318
  ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2, r);
@@ -7320,12 +7320,11 @@ var __privateMethod = (obj, member, method) => {
7320
7320
  ctx.arcTo(x2, y2 + h2, x2, y2, r);
7321
7321
  ctx.arcTo(x2, y2, x2 + w2, y2, r);
7322
7322
  ctx.closePath();
7323
- ctx.fillStyle = color2;
7323
+ ctx.fillStyle = background2;
7324
7324
  ctx.fill();
7325
- ctx.globalAlpha = 1;
7326
7325
  ctx.beginPath();
7327
7326
  ctx.lineWidth = 1;
7328
- ctx.strokeStyle = color2;
7327
+ ctx.strokeStyle = borderColor2;
7329
7328
  ctx.setLineDash([]);
7330
7329
  ctx.moveTo(x2 + r, y2);
7331
7330
  ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2, r);
@@ -7339,9 +7338,9 @@ var __privateMethod = (obj, member, method) => {
7339
7338
  }
7340
7339
  function drawScrollerInfo(overlayContext, opts) {
7341
7340
  const ctx = overlayContext;
7342
- const { viewScaleInfo, viewSizeInfo, scrollInfo } = opts;
7341
+ const { viewScaleInfo, viewSizeInfo, scrollInfo, style } = opts;
7343
7342
  const { activeThumbType, prevPoint, activePoint, hoverXThumb, hoverYThumb } = scrollInfo;
7344
- const wrapper = calcScrollerInfo({ viewScaleInfo, viewSizeInfo, hoverXThumb, hoverYThumb });
7343
+ const wrapper = calcScrollerInfo({ viewScaleInfo, viewSizeInfo, hoverXThumb, hoverYThumb, style });
7345
7344
  let xThumbRect = { ...wrapper.xThumbRect };
7346
7345
  let yThumbRect = { ...wrapper.yThumbRect };
7347
7346
  if (activeThumbType && prevPoint && activePoint) {
@@ -7357,34 +7356,48 @@ var __privateMethod = (obj, member, method) => {
7357
7356
  axis: "X",
7358
7357
  ...xThumbRect,
7359
7358
  r: wrapper.lineSize / 2,
7360
- color: wrapper.xThumbColor
7359
+ background: wrapper.xThumbBackground,
7360
+ borderColor: wrapper.xThumbBorderColor
7361
7361
  });
7362
7362
  drawScrollerThumb(ctx, {
7363
7363
  axis: "Y",
7364
7364
  ...yThumbRect,
7365
7365
  r: wrapper.lineSize / 2,
7366
- color: wrapper.yThumbColor
7366
+ background: wrapper.yThumbBackground,
7367
+ borderColor: wrapper.yThumbBorderColor
7367
7368
  });
7368
- ctx.globalAlpha = 1;
7369
7369
  return {
7370
7370
  xThumbRect,
7371
7371
  yThumbRect
7372
7372
  };
7373
7373
  }
7374
7374
  function drawScroller(ctx, opts) {
7375
- const { snapshot } = opts;
7375
+ const { snapshot, style } = opts;
7376
7376
  const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
7377
7377
  const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
7378
7378
  const scrollInfo = getScrollInfoFromSnapshot(snapshot);
7379
- const { xThumbRect, yThumbRect } = drawScrollerInfo(ctx, { viewSizeInfo, viewScaleInfo, scrollInfo });
7379
+ const { xThumbRect, yThumbRect } = drawScrollerInfo(ctx, { viewSizeInfo, viewScaleInfo, scrollInfo, style });
7380
7380
  return { xThumbRect, yThumbRect };
7381
7381
  }
7382
- const MiddlewareScroller = (opts) => {
7382
+ const MiddlewareScroller = (opts, config) => {
7383
7383
  const { viewer, boardContent, sharer, eventHub } = opts;
7384
7384
  const { overlayContext } = boardContent;
7385
7385
  sharer.setSharedStorage(keyXThumbRect, null);
7386
7386
  sharer.setSharedStorage(keyYThumbRect, null);
7387
7387
  let isBusy = false;
7388
+ const innerConfig = {
7389
+ ...defaultStyle$1,
7390
+ ...config
7391
+ };
7392
+ const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor, activeThumbBackground, activeThumbBorderColor } = innerConfig;
7393
+ const style = {
7394
+ thumbBackground,
7395
+ thumbBorderColor,
7396
+ hoverThumbBackground,
7397
+ hoverThumbBorderColor,
7398
+ activeThumbBackground,
7399
+ activeThumbBorderColor
7400
+ };
7388
7401
  const clear = () => {
7389
7402
  sharer.setSharedStorage(keyPrevPoint$1, null);
7390
7403
  sharer.setSharedStorage(keyActivePoint, null);
@@ -7488,7 +7501,7 @@ var __privateMethod = (obj, member, method) => {
7488
7501
  }
7489
7502
  },
7490
7503
  beforeDrawFrame({ snapshot }) {
7491
- const { xThumbRect, yThumbRect } = drawScroller(overlayContext, { snapshot });
7504
+ const { xThumbRect, yThumbRect } = drawScroller(overlayContext, { snapshot, style });
7492
7505
  sharer.setSharedStorage(keyXThumbRect, xThumbRect);
7493
7506
  sharer.setSharedStorage(keyYThumbRect, yThumbRect);
7494
7507
  }
@@ -7522,17 +7535,26 @@ var __privateMethod = (obj, member, method) => {
7522
7535
  };
7523
7536
  };
7524
7537
  const rulerSize = 16;
7538
+ const fontSize = 10;
7539
+ const fontWeight = 100;
7540
+ const lineSize = 1;
7541
+ const fontFamily$1 = "monospace";
7525
7542
  const background = "#FFFFFFA8";
7526
7543
  const borderColor = "#00000080";
7527
7544
  const scaleColor = "#000000";
7528
7545
  const textColor = "#00000080";
7529
- const fontFamily$1 = "monospace";
7530
- const fontSize = 10;
7531
- const fontWeight = 100;
7532
7546
  const gridColor = "#AAAAAA20";
7533
- const gridKeyColor = "#AAAAAA40";
7534
- const lineSize = 1;
7547
+ const gridPrimaryColor = "#AAAAAA40";
7535
7548
  const selectedAreaColor = "#196097";
7549
+ const defaultStyle = {
7550
+ background,
7551
+ borderColor,
7552
+ scaleColor,
7553
+ textColor,
7554
+ gridColor,
7555
+ gridPrimaryColor,
7556
+ selectedAreaColor
7557
+ };
7536
7558
  const limitRulerUnitList = [1, 2, 5, 10, 20, 50, 100, 200, 500];
7537
7559
  function limitRulerUnit(unit) {
7538
7560
  unit = Math.max(limitRulerUnitList[0], Math.min(unit, limitRulerUnitList[limitRulerUnitList.length - 1]));
@@ -7609,7 +7631,8 @@ var __privateMethod = (obj, member, method) => {
7609
7631
  });
7610
7632
  }
7611
7633
  function drawXRuler(ctx, opts) {
7612
- const { scaleList } = opts;
7634
+ const { scaleList, style } = opts;
7635
+ const { scaleColor: scaleColor2, textColor: textColor2 } = style;
7613
7636
  const scaleDrawStart = rulerSize;
7614
7637
  const scaleDrawEnd = rulerSize * 4 / 5;
7615
7638
  const subKeyScaleDrawEnd = rulerSize * 2 / 5;
@@ -7626,10 +7649,10 @@ var __privateMethod = (obj, member, method) => {
7626
7649
  ctx.closePath();
7627
7650
  ctx.lineWidth = lineSize;
7628
7651
  ctx.setLineDash([]);
7629
- ctx.fillStyle = scaleColor;
7652
+ ctx.fillStyle = scaleColor2;
7630
7653
  ctx.stroke();
7631
7654
  if (item.isKeyNum) {
7632
- ctx.fillStyle = textColor;
7655
+ ctx.fillStyle = textColor2;
7633
7656
  ctx.textBaseline = "top";
7634
7657
  ctx.$setFont({
7635
7658
  fontWeight,
@@ -7641,7 +7664,8 @@ var __privateMethod = (obj, member, method) => {
7641
7664
  }
7642
7665
  }
7643
7666
  function drawYRuler(ctx, opts) {
7644
- const { scaleList } = opts;
7667
+ const { scaleList, style } = opts;
7668
+ const { scaleColor: scaleColor2, textColor: textColor2 } = style;
7645
7669
  const scaleDrawStart = rulerSize;
7646
7670
  const scaleDrawEnd = rulerSize * 4 / 5;
7647
7671
  const subKeyScaleDrawEnd = rulerSize * 2 / 5;
@@ -7656,7 +7680,7 @@ var __privateMethod = (obj, member, method) => {
7656
7680
  ctx.moveTo(scaleDrawStart, item.position);
7657
7681
  ctx.lineTo(item.isKeyNum ? keyScaleDrawEnd : item.isSubKeyNum ? subKeyScaleDrawEnd : scaleDrawEnd, item.position);
7658
7682
  ctx.closePath();
7659
- ctx.fillStyle = scaleColor;
7683
+ ctx.fillStyle = scaleColor2;
7660
7684
  ctx.lineWidth = lineSize;
7661
7685
  ctx.setLineDash([]);
7662
7686
  ctx.stroke();
@@ -7665,7 +7689,7 @@ var __privateMethod = (obj, member, method) => {
7665
7689
  const textY = item.position + fontStart;
7666
7690
  const numText = `${item.num}`;
7667
7691
  rotateByCenter(ctx, -90, { x: textX, y: textY }, () => {
7668
- ctx.fillStyle = textColor;
7692
+ ctx.fillStyle = textColor2;
7669
7693
  ctx.textBaseline = "top";
7670
7694
  ctx.$setFont({
7671
7695
  fontWeight,
@@ -7678,8 +7702,9 @@ var __privateMethod = (obj, member, method) => {
7678
7702
  }
7679
7703
  }
7680
7704
  function drawRulerBackground(ctx, opts) {
7681
- const { viewSizeInfo } = opts;
7705
+ const { viewSizeInfo, style } = opts;
7682
7706
  const { width, height } = viewSizeInfo;
7707
+ const { background: background2, borderColor: borderColor2 } = style;
7683
7708
  ctx.beginPath();
7684
7709
  ctx.moveTo(0, 0);
7685
7710
  ctx.lineTo(width + 1, 0);
@@ -7689,25 +7714,26 @@ var __privateMethod = (obj, member, method) => {
7689
7714
  ctx.lineTo(0, height + 1);
7690
7715
  ctx.lineTo(0, 0);
7691
7716
  ctx.closePath();
7692
- ctx.fillStyle = background;
7717
+ ctx.fillStyle = background2;
7693
7718
  ctx.fill();
7694
7719
  ctx.lineWidth = lineSize;
7695
7720
  ctx.setLineDash([]);
7696
- ctx.strokeStyle = borderColor;
7721
+ ctx.strokeStyle = borderColor2;
7697
7722
  ctx.stroke();
7698
7723
  }
7699
7724
  function drawGrid(ctx, opts) {
7700
- const { xList, yList, viewSizeInfo } = opts;
7725
+ const { xList, yList, viewSizeInfo, style } = opts;
7701
7726
  const { width, height } = viewSizeInfo;
7727
+ const { gridColor: gridColor2, gridPrimaryColor: gridPrimaryColor2 } = style;
7702
7728
  for (let i = 0; i < xList.length; i++) {
7703
7729
  const item = xList[i];
7704
7730
  ctx.beginPath();
7705
7731
  ctx.moveTo(item.position, 0);
7706
7732
  ctx.lineTo(item.position, height);
7707
7733
  if (item.isKeyNum === true || item.isSubKeyNum === true) {
7708
- ctx.strokeStyle = gridKeyColor;
7734
+ ctx.strokeStyle = gridPrimaryColor2;
7709
7735
  } else {
7710
- ctx.strokeStyle = gridColor;
7736
+ ctx.strokeStyle = gridColor2;
7711
7737
  }
7712
7738
  ctx.closePath();
7713
7739
  ctx.lineWidth = lineSize;
@@ -7720,9 +7746,9 @@ var __privateMethod = (obj, member, method) => {
7720
7746
  ctx.moveTo(0, item.position);
7721
7747
  ctx.lineTo(width, item.position);
7722
7748
  if (item.isKeyNum === true || item.isSubKeyNum === true) {
7723
- ctx.strokeStyle = gridKeyColor;
7749
+ ctx.strokeStyle = gridPrimaryColor2;
7724
7750
  } else {
7725
- ctx.strokeStyle = gridColor;
7751
+ ctx.strokeStyle = gridColor2;
7726
7752
  }
7727
7753
  ctx.lineWidth = 1;
7728
7754
  ctx.closePath();
@@ -7730,8 +7756,9 @@ var __privateMethod = (obj, member, method) => {
7730
7756
  }
7731
7757
  }
7732
7758
  function drawScrollerSelectedArea(ctx, opts) {
7733
- const { snapshot, calculator } = opts;
7759
+ const { snapshot, calculator, style } = opts;
7734
7760
  const { sharedStore } = snapshot;
7761
+ const { selectedAreaColor: selectedAreaColor2 } = style;
7735
7762
  const selectedElementList = sharedStore[keySelectedElementList];
7736
7763
  const actionType = sharedStore[keyActionType];
7737
7764
  if (["select", "drag", "drag-list", "drag-list-end"].includes(actionType) && selectedElementList.length > 0) {
@@ -7768,7 +7795,7 @@ var __privateMethod = (obj, member, method) => {
7768
7795
  ctx.lineTo(xAreaEnd, 0);
7769
7796
  ctx.lineTo(xAreaEnd, rulerSize);
7770
7797
  ctx.lineTo(xAreaStart, rulerSize);
7771
- ctx.fillStyle = selectedAreaColor;
7798
+ ctx.fillStyle = selectedAreaColor2;
7772
7799
  ctx.closePath();
7773
7800
  ctx.fill();
7774
7801
  ctx.beginPath();
@@ -7776,15 +7803,29 @@ var __privateMethod = (obj, member, method) => {
7776
7803
  ctx.lineTo(rulerSize, yAreaStart);
7777
7804
  ctx.lineTo(rulerSize, yAreaEnd);
7778
7805
  ctx.lineTo(0, yAreaEnd);
7779
- ctx.fillStyle = selectedAreaColor;
7806
+ ctx.fillStyle = selectedAreaColor2;
7780
7807
  ctx.closePath();
7781
7808
  ctx.fill();
7782
7809
  }
7783
7810
  }
7784
7811
  const middlewareEventRuler = "@middleware/show-ruler";
7785
- const MiddlewareRuler = (opts) => {
7812
+ const MiddlewareRuler = (opts, config) => {
7786
7813
  const { boardContent, viewer, eventHub, calculator } = opts;
7787
7814
  const { overlayContext, underlayContext } = boardContent;
7815
+ const innerConfig = {
7816
+ ...defaultStyle,
7817
+ ...config
7818
+ };
7819
+ const { background: background2, borderColor: borderColor2, scaleColor: scaleColor2, textColor: textColor2, gridColor: gridColor2, gridPrimaryColor: gridPrimaryColor2, selectedAreaColor: selectedAreaColor2 } = innerConfig;
7820
+ const style = {
7821
+ background: background2,
7822
+ borderColor: borderColor2,
7823
+ scaleColor: scaleColor2,
7824
+ textColor: textColor2,
7825
+ gridColor: gridColor2,
7826
+ gridPrimaryColor: gridPrimaryColor2,
7827
+ selectedAreaColor: selectedAreaColor2
7828
+ };
7788
7829
  let show = true;
7789
7830
  let showGrid = true;
7790
7831
  const rulerCallback = (e) => {
@@ -7810,19 +7851,20 @@ var __privateMethod = (obj, member, method) => {
7810
7851
  if (show === true) {
7811
7852
  const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
7812
7853
  const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
7813
- drawScrollerSelectedArea(overlayContext, { snapshot, calculator });
7814
- drawRulerBackground(overlayContext, { viewScaleInfo, viewSizeInfo });
7854
+ drawScrollerSelectedArea(overlayContext, { snapshot, calculator, style });
7855
+ drawRulerBackground(overlayContext, { viewScaleInfo, viewSizeInfo, style });
7815
7856
  const { list: xList, rulerUnit } = calcXRulerScaleList({ viewScaleInfo, viewSizeInfo });
7816
- drawXRuler(overlayContext, { scaleList: xList });
7857
+ drawXRuler(overlayContext, { scaleList: xList, style });
7817
7858
  const { list: yList } = calcYRulerScaleList({ viewScaleInfo, viewSizeInfo });
7818
- drawYRuler(overlayContext, { scaleList: yList });
7859
+ drawYRuler(overlayContext, { scaleList: yList, style });
7819
7860
  if (showGrid === true) {
7820
7861
  const ctx = rulerUnit === 1 ? overlayContext : underlayContext;
7821
7862
  drawGrid(ctx, {
7822
7863
  xList,
7823
7864
  yList,
7824
7865
  viewScaleInfo,
7825
- viewSizeInfo
7866
+ viewSizeInfo,
7867
+ style
7826
7868
  });
7827
7869
  }
7828
7870
  }
@@ -7874,7 +7916,8 @@ var __privateMethod = (obj, member, method) => {
7874
7916
  };
7875
7917
  const fontFamily = "monospace";
7876
7918
  function drawSizeInfoText(ctx, opts) {
7877
- const { point, rotateCenter, angle: angle2, text: text2, color: color2, background: background2, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
7919
+ const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
7920
+ const { textColor: textColor2, textBackground } = style;
7878
7921
  rotateByCenter(ctx, angle2, rotateCenter, () => {
7879
7922
  ctx.$setFont({
7880
7923
  fontWeight: "300",
@@ -7896,7 +7939,7 @@ var __privateMethod = (obj, member, method) => {
7896
7939
  y: point.y
7897
7940
  };
7898
7941
  ctx.setLineDash([]);
7899
- ctx.fillStyle = background2;
7942
+ ctx.fillStyle = textBackground;
7900
7943
  ctx.beginPath();
7901
7944
  ctx.moveTo(bgStart.x, bgStart.y);
7902
7945
  ctx.lineTo(bgEnd.x, bgStart.y);
@@ -7904,13 +7947,14 @@ var __privateMethod = (obj, member, method) => {
7904
7947
  ctx.lineTo(bgStart.x, bgEnd.y);
7905
7948
  ctx.closePath();
7906
7949
  ctx.fill();
7907
- ctx.fillStyle = color2;
7950
+ ctx.fillStyle = textColor2;
7908
7951
  ctx.textBaseline = "top";
7909
7952
  ctx.fillText(text2, textStart.x, textStart.y + padding);
7910
7953
  });
7911
7954
  }
7912
7955
  function drawPositionInfoText(ctx, opts) {
7913
- const { point, rotateCenter, angle: angle2, text: text2, color: color2, background: background2, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
7956
+ const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
7957
+ const { textBackground, textColor: textColor2 } = style;
7914
7958
  rotateByCenter(ctx, angle2, rotateCenter, () => {
7915
7959
  ctx.$setFont({
7916
7960
  fontWeight: "300",
@@ -7932,7 +7976,7 @@ var __privateMethod = (obj, member, method) => {
7932
7976
  y: point.y
7933
7977
  };
7934
7978
  ctx.setLineDash([]);
7935
- ctx.fillStyle = background2;
7979
+ ctx.fillStyle = textBackground;
7936
7980
  ctx.beginPath();
7937
7981
  ctx.moveTo(bgStart.x, bgStart.y);
7938
7982
  ctx.lineTo(bgEnd.x, bgStart.y);
@@ -7940,13 +7984,14 @@ var __privateMethod = (obj, member, method) => {
7940
7984
  ctx.lineTo(bgStart.x, bgEnd.y);
7941
7985
  ctx.closePath();
7942
7986
  ctx.fill();
7943
- ctx.fillStyle = color2;
7987
+ ctx.fillStyle = textColor2;
7944
7988
  ctx.textBaseline = "top";
7945
7989
  ctx.fillText(text2, textStart.x, textStart.y + padding);
7946
7990
  });
7947
7991
  }
7948
7992
  function drawAngleInfoText(ctx, opts) {
7949
- const { point, rotateCenter, angle: angle2, text: text2, color: color2, background: background2, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
7993
+ const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
7994
+ const { textBackground, textColor: textColor2 } = style;
7950
7995
  rotateByCenter(ctx, angle2, rotateCenter, () => {
7951
7996
  ctx.$setFont({
7952
7997
  fontWeight: "300",
@@ -7968,7 +8013,7 @@ var __privateMethod = (obj, member, method) => {
7968
8013
  y: point.y
7969
8014
  };
7970
8015
  ctx.setLineDash([]);
7971
- ctx.fillStyle = background2;
8016
+ ctx.fillStyle = textBackground;
7972
8017
  ctx.beginPath();
7973
8018
  ctx.moveTo(bgStart.x, bgStart.y);
7974
8019
  ctx.lineTo(bgEnd.x, bgStart.y);
@@ -7976,18 +8021,31 @@ var __privateMethod = (obj, member, method) => {
7976
8021
  ctx.lineTo(bgStart.x, bgEnd.y);
7977
8022
  ctx.closePath();
7978
8023
  ctx.fill();
7979
- ctx.fillStyle = color2;
8024
+ ctx.fillStyle = textColor2;
7980
8025
  ctx.textBaseline = "top";
7981
8026
  ctx.fillText(text2, textStart.x, textStart.y + padding);
7982
8027
  });
7983
8028
  }
7984
8029
  const infoBackground = "#1973bac6";
7985
8030
  const infoTextColor = "#ffffff";
8031
+ const defaltStyle = {
8032
+ textBackground: infoBackground,
8033
+ textColor: infoTextColor
8034
+ };
7986
8035
  const infoFontSize = 10;
7987
8036
  const infoLineHeight = 16;
7988
- const MiddlewareInfo = (opts) => {
8037
+ const MiddlewareInfo = (opts, config) => {
7989
8038
  const { boardContent, calculator } = opts;
7990
8039
  const { overlayContext } = boardContent;
8040
+ const innerConfig = {
8041
+ ...defaltStyle,
8042
+ ...config
8043
+ };
8044
+ const { textBackground, textColor: textColor2 } = innerConfig;
8045
+ const style = {
8046
+ textBackground,
8047
+ textColor: textColor2
8048
+ };
7991
8049
  return {
7992
8050
  name: "@middleware/info",
7993
8051
  beforeDrawFrame({ snapshot }) {
@@ -8053,8 +8111,7 @@ var __privateMethod = (obj, member, method) => {
8053
8111
  text: whText,
8054
8112
  fontSize: infoFontSize,
8055
8113
  lineHeight: infoLineHeight,
8056
- color: infoTextColor,
8057
- background: infoBackground
8114
+ style
8058
8115
  });
8059
8116
  drawPositionInfoText(overlayContext, {
8060
8117
  point: {
@@ -8066,8 +8123,7 @@ var __privateMethod = (obj, member, method) => {
8066
8123
  text: xyText,
8067
8124
  fontSize: infoFontSize,
8068
8125
  lineHeight: infoLineHeight,
8069
- color: infoTextColor,
8070
- background: infoBackground
8126
+ style
8071
8127
  });
8072
8128
  drawAngleInfoText(overlayContext, {
8073
8129
  point: {
@@ -8079,8 +8135,7 @@ var __privateMethod = (obj, member, method) => {
8079
8135
  text: angleText,
8080
8136
  fontSize: infoFontSize,
8081
8137
  lineHeight: infoLineHeight,
8082
- color: infoTextColor,
8083
- background: infoBackground
8138
+ style
8084
8139
  });
8085
8140
  }
8086
8141
  }
@@ -8125,8 +8180,8 @@ var __privateMethod = (obj, member, method) => {
8125
8180
  __privateGet(this, _board).destroy();
8126
8181
  __privateGet(this, _canvas).remove();
8127
8182
  }
8128
- use(middleware) {
8129
- __privateGet(this, _board).use(middleware);
8183
+ use(middleware, config) {
8184
+ __privateGet(this, _board).use(middleware, config);
8130
8185
  }
8131
8186
  disuse(middleware) {
8132
8187
  __privateGet(this, _board).disuse(middleware);