@idraw/core 0.4.0-beta.30 → 0.4.0-beta.31
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.
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/middleware/info/config.d.ts +4 -0
- package/dist/esm/middleware/info/config.js +8 -0
- package/dist/esm/middleware/info/draw-info.d.ts +4 -6
- package/dist/esm/middleware/info/draw-info.js +12 -9
- package/dist/esm/middleware/info/index.d.ts +2 -2
- package/dist/esm/middleware/info/index.js +11 -9
- package/dist/esm/middleware/ruler/config.d.ts +7 -0
- package/dist/esm/middleware/ruler/config.js +21 -0
- package/dist/esm/middleware/ruler/index.d.ts +2 -2
- package/dist/esm/middleware/ruler/index.js +19 -6
- package/dist/esm/middleware/ruler/util.d.ts +6 -1
- package/dist/esm/middleware/ruler/util.js +13 -19
- package/dist/esm/middleware/scroller/config.d.ts +2 -0
- package/dist/esm/middleware/scroller/config.js +8 -0
- package/dist/esm/middleware/scroller/index.d.ts +2 -2
- package/dist/esm/middleware/scroller/index.js +13 -3
- package/dist/esm/middleware/scroller/util.d.ts +2 -1
- package/dist/esm/middleware/scroller/util.js +19 -36
- package/dist/esm/middleware/selector/config.d.ts +2 -4
- package/dist/esm/middleware/selector/config.js +10 -4
- package/dist/esm/middleware/selector/draw-auxiliary.d.ts +1 -7
- package/dist/esm/middleware/selector/draw-auxiliary.js +1 -35
- package/dist/esm/middleware/selector/draw-reference.d.ts +2 -0
- package/dist/esm/middleware/selector/draw-reference.js +2 -2
- package/dist/esm/middleware/selector/draw-wrapper.d.ts +7 -1
- package/dist/esm/middleware/selector/draw-wrapper.js +22 -13
- package/dist/esm/middleware/selector/index.d.ts +2 -2
- package/dist/esm/middleware/selector/index.js +16 -11
- package/dist/index.global.js +193 -104
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -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$2 = {
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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 =
|
|
4761
|
-
ctx.fillStyle =
|
|
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 =
|
|
4777
|
-
ctx.fillStyle =
|
|
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:
|
|
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:
|
|
4816
|
+
borderColor: referenceColor2,
|
|
4798
4817
|
borderWidth: 1,
|
|
4799
4818
|
lineDash: []
|
|
4800
4819
|
};
|
|
@@ -6494,7 +6513,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
6494
6513
|
}
|
|
6495
6514
|
};
|
|
6496
6515
|
};
|
|
6497
|
-
const MiddlewareSelector = (opts) => {
|
|
6516
|
+
const MiddlewareSelector = (opts, config) => {
|
|
6517
|
+
const innerConfig = {
|
|
6518
|
+
...defaultStyle$2,
|
|
6519
|
+
...config
|
|
6520
|
+
};
|
|
6521
|
+
const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
|
|
6522
|
+
const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
|
|
6498
6523
|
const { viewer, sharer, boardContent, calculator, eventHub } = opts;
|
|
6499
6524
|
const { overlayContext } = boardContent;
|
|
6500
6525
|
let prevPoint = null;
|
|
@@ -7066,7 +7091,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7066
7091
|
const groupQueueVertexesList = sharedStore[keyGroupQueueVertexesList];
|
|
7067
7092
|
const isMoving = sharedStore[keyIsMoving];
|
|
7068
7093
|
const enableSnapToGrid = sharedStore[keyEnableSnapToGrid];
|
|
7069
|
-
const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo };
|
|
7094
|
+
const drawBaseOpts = { calculator, viewScaleInfo, viewSizeInfo, style };
|
|
7070
7095
|
const selectedElementController = elem ? calcElementSizeController(elem, {
|
|
7071
7096
|
groupQueue,
|
|
7072
7097
|
controllerSize: 10,
|
|
@@ -7083,7 +7108,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7083
7108
|
groupQueue,
|
|
7084
7109
|
controllerSize: 10,
|
|
7085
7110
|
viewScaleInfo
|
|
7086
|
-
})
|
|
7111
|
+
}),
|
|
7112
|
+
style
|
|
7087
7113
|
});
|
|
7088
7114
|
} else {
|
|
7089
7115
|
drawHoverVertexesWrapper(overlayContext, hoverElementVertexes, drawBaseOpts);
|
|
@@ -7094,7 +7120,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7094
7120
|
...drawBaseOpts,
|
|
7095
7121
|
element: elem,
|
|
7096
7122
|
calculator,
|
|
7097
|
-
hideControllers: !!isMoving && actionType === "drag"
|
|
7123
|
+
hideControllers: !!isMoving && actionType === "drag",
|
|
7124
|
+
style
|
|
7098
7125
|
});
|
|
7099
7126
|
if (actionType === "drag") {
|
|
7100
7127
|
if (enableSnapToGrid === true) {
|
|
@@ -7110,7 +7137,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7110
7137
|
if (offsetX === 0 || offsetY === 0) {
|
|
7111
7138
|
drawReferenceLines(overlayContext, {
|
|
7112
7139
|
xLines,
|
|
7113
|
-
yLines
|
|
7140
|
+
yLines,
|
|
7141
|
+
style
|
|
7114
7142
|
});
|
|
7115
7143
|
}
|
|
7116
7144
|
}
|
|
@@ -7126,7 +7154,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7126
7154
|
groupQueue,
|
|
7127
7155
|
controllerSize: 10,
|
|
7128
7156
|
viewScaleInfo
|
|
7129
|
-
})
|
|
7157
|
+
}),
|
|
7158
|
+
style
|
|
7130
7159
|
});
|
|
7131
7160
|
} else {
|
|
7132
7161
|
drawHoverVertexesWrapper(overlayContext, hoverElementVertexes, drawBaseOpts);
|
|
@@ -7137,7 +7166,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7137
7166
|
...drawBaseOpts,
|
|
7138
7167
|
element: elem,
|
|
7139
7168
|
calculator,
|
|
7140
|
-
hideControllers: !!isMoving && actionType === "drag"
|
|
7169
|
+
hideControllers: !!isMoving && actionType === "drag",
|
|
7170
|
+
style
|
|
7141
7171
|
});
|
|
7142
7172
|
if (actionType === "drag") {
|
|
7143
7173
|
if (enableSnapToGrid === true) {
|
|
@@ -7153,14 +7183,15 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7153
7183
|
if (offsetX === 0 || offsetY === 0) {
|
|
7154
7184
|
drawReferenceLines(overlayContext, {
|
|
7155
7185
|
xLines,
|
|
7156
|
-
yLines
|
|
7186
|
+
yLines,
|
|
7187
|
+
style
|
|
7157
7188
|
});
|
|
7158
7189
|
}
|
|
7159
7190
|
}
|
|
7160
7191
|
}
|
|
7161
7192
|
}
|
|
7162
7193
|
} else if (actionType === "area" && areaStart && areaEnd) {
|
|
7163
|
-
drawArea(overlayContext, { start: areaStart, end: areaEnd });
|
|
7194
|
+
drawArea(overlayContext, { start: areaStart, end: areaEnd, style });
|
|
7164
7195
|
} else if (["drag-list", "drag-list-end"].includes(actionType)) {
|
|
7165
7196
|
const listAreaSize = calcSelectedElementsArea(getActiveElements(), {
|
|
7166
7197
|
viewScaleInfo: sharer2.getActiveViewScaleInfo(),
|
|
@@ -7168,7 +7199,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7168
7199
|
calculator
|
|
7169
7200
|
});
|
|
7170
7201
|
if (listAreaSize) {
|
|
7171
|
-
drawListArea(overlayContext, { areaSize: listAreaSize });
|
|
7202
|
+
drawListArea(overlayContext, { areaSize: listAreaSize, style });
|
|
7172
7203
|
}
|
|
7173
7204
|
}
|
|
7174
7205
|
}
|
|
@@ -7183,16 +7214,16 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7183
7214
|
const keyPrevPoint$1 = Symbol(`${key$1}_prevPoint`);
|
|
7184
7215
|
const keyActivePoint = Symbol(`${key$1}_activePoint`);
|
|
7185
7216
|
const keyActiveThumbType = Symbol(`${key$1}_activeThumbType`);
|
|
7186
|
-
const
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
scrollBarColor: "#FFFFFF60",
|
|
7194
|
-
showScrollBar: false
|
|
7217
|
+
const defaultStyle$1 = {
|
|
7218
|
+
thumbBackground: "#0000003A",
|
|
7219
|
+
thumbBorderColor: "#0000008A",
|
|
7220
|
+
hoverThumbBackground: "#0000005F",
|
|
7221
|
+
hoverThumbBorderColor: "#000000EE",
|
|
7222
|
+
activeThumbBackground: "#0000005E",
|
|
7223
|
+
activeThumbBorderColor: "#000000F0"
|
|
7195
7224
|
};
|
|
7225
|
+
const scrollerLineWidth = 16;
|
|
7226
|
+
const minThumbLength = scrollerLineWidth * 2.5;
|
|
7196
7227
|
function isPointAtRect(overlayContext, p, rect) {
|
|
7197
7228
|
const ctx = overlayContext;
|
|
7198
7229
|
const { x: x2, y: y2, w: w2, h: h2 } = rect;
|
|
@@ -7228,11 +7259,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7228
7259
|
return info;
|
|
7229
7260
|
}
|
|
7230
7261
|
function calcScrollerInfo(opts) {
|
|
7231
|
-
const { viewScaleInfo, viewSizeInfo, hoverXThumb, hoverYThumb } = opts;
|
|
7262
|
+
const { viewScaleInfo, viewSizeInfo, hoverXThumb, hoverYThumb, style } = opts;
|
|
7232
7263
|
const { width, height } = viewSizeInfo;
|
|
7233
7264
|
const { offsetTop, offsetBottom, offsetLeft, offsetRight } = viewScaleInfo;
|
|
7234
|
-
const sliderMinSize =
|
|
7265
|
+
const sliderMinSize = minThumbLength;
|
|
7235
7266
|
const lineSize2 = scrollerLineWidth;
|
|
7267
|
+
const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor } = style;
|
|
7236
7268
|
let xSize = 0;
|
|
7237
7269
|
let ySize = 0;
|
|
7238
7270
|
xSize = Math.max(sliderMinSize, width - lineSize2 * 2 - (Math.abs(offsetLeft) + Math.abs(offsetRight)));
|
|
@@ -7283,23 +7315,25 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7283
7315
|
ySize,
|
|
7284
7316
|
translateY,
|
|
7285
7317
|
translateX,
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7318
|
+
xThumbBackground: hoverXThumb ? hoverThumbBackground : thumbBackground,
|
|
7319
|
+
yThumbBackground: hoverYThumb ? hoverThumbBackground : thumbBackground,
|
|
7320
|
+
xThumbBorderColor: hoverXThumb ? hoverThumbBorderColor : thumbBorderColor,
|
|
7321
|
+
yThumbBorderColor: hoverYThumb ? hoverThumbBorderColor : thumbBorderColor,
|
|
7322
|
+
// scrollBarColor: scrollConfig.scrollBarColor,
|
|
7289
7323
|
xThumbRect,
|
|
7290
7324
|
yThumbRect
|
|
7291
7325
|
};
|
|
7292
7326
|
return scrollWrapper;
|
|
7293
7327
|
}
|
|
7294
7328
|
function drawScrollerThumb(ctx, opts) {
|
|
7295
|
-
let { x: x2, y: y2, h: h2, w: w2 } = opts;
|
|
7329
|
+
let { x: x2, y: y2, h: h2, w: w2, background: background2, borderColor: borderColor2 } = opts;
|
|
7296
7330
|
ctx.save();
|
|
7297
7331
|
ctx.shadowColor = "#FFFFFF";
|
|
7298
7332
|
ctx.shadowOffsetX = 0;
|
|
7299
7333
|
ctx.shadowOffsetY = 0;
|
|
7300
7334
|
ctx.shadowBlur = 1;
|
|
7301
7335
|
{
|
|
7302
|
-
const {
|
|
7336
|
+
const { axis } = opts;
|
|
7303
7337
|
if (axis === "X") {
|
|
7304
7338
|
y2 = y2 + h2 / 4 + 0;
|
|
7305
7339
|
h2 = h2 / 2;
|
|
@@ -7312,7 +7346,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7312
7346
|
if (w2 < r * 2 || h2 < r * 2) {
|
|
7313
7347
|
r = 0;
|
|
7314
7348
|
}
|
|
7315
|
-
ctx.globalAlpha =
|
|
7349
|
+
ctx.globalAlpha = 1;
|
|
7316
7350
|
ctx.beginPath();
|
|
7317
7351
|
ctx.moveTo(x2 + r, y2);
|
|
7318
7352
|
ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2, r);
|
|
@@ -7320,12 +7354,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7320
7354
|
ctx.arcTo(x2, y2 + h2, x2, y2, r);
|
|
7321
7355
|
ctx.arcTo(x2, y2, x2 + w2, y2, r);
|
|
7322
7356
|
ctx.closePath();
|
|
7323
|
-
ctx.fillStyle =
|
|
7357
|
+
ctx.fillStyle = background2;
|
|
7324
7358
|
ctx.fill();
|
|
7325
|
-
ctx.globalAlpha = 1;
|
|
7326
7359
|
ctx.beginPath();
|
|
7327
7360
|
ctx.lineWidth = 1;
|
|
7328
|
-
ctx.strokeStyle =
|
|
7361
|
+
ctx.strokeStyle = borderColor2;
|
|
7329
7362
|
ctx.setLineDash([]);
|
|
7330
7363
|
ctx.moveTo(x2 + r, y2);
|
|
7331
7364
|
ctx.arcTo(x2 + w2, y2, x2 + w2, y2 + h2, r);
|
|
@@ -7339,9 +7372,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7339
7372
|
}
|
|
7340
7373
|
function drawScrollerInfo(overlayContext, opts) {
|
|
7341
7374
|
const ctx = overlayContext;
|
|
7342
|
-
const { viewScaleInfo, viewSizeInfo, scrollInfo } = opts;
|
|
7375
|
+
const { viewScaleInfo, viewSizeInfo, scrollInfo, style } = opts;
|
|
7343
7376
|
const { activeThumbType, prevPoint, activePoint, hoverXThumb, hoverYThumb } = scrollInfo;
|
|
7344
|
-
const wrapper = calcScrollerInfo({ viewScaleInfo, viewSizeInfo, hoverXThumb, hoverYThumb });
|
|
7377
|
+
const wrapper = calcScrollerInfo({ viewScaleInfo, viewSizeInfo, hoverXThumb, hoverYThumb, style });
|
|
7345
7378
|
let xThumbRect = { ...wrapper.xThumbRect };
|
|
7346
7379
|
let yThumbRect = { ...wrapper.yThumbRect };
|
|
7347
7380
|
if (activeThumbType && prevPoint && activePoint) {
|
|
@@ -7357,34 +7390,48 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7357
7390
|
axis: "X",
|
|
7358
7391
|
...xThumbRect,
|
|
7359
7392
|
r: wrapper.lineSize / 2,
|
|
7360
|
-
|
|
7393
|
+
background: wrapper.xThumbBackground,
|
|
7394
|
+
borderColor: wrapper.xThumbBorderColor
|
|
7361
7395
|
});
|
|
7362
7396
|
drawScrollerThumb(ctx, {
|
|
7363
7397
|
axis: "Y",
|
|
7364
7398
|
...yThumbRect,
|
|
7365
7399
|
r: wrapper.lineSize / 2,
|
|
7366
|
-
|
|
7400
|
+
background: wrapper.yThumbBackground,
|
|
7401
|
+
borderColor: wrapper.yThumbBorderColor
|
|
7367
7402
|
});
|
|
7368
|
-
ctx.globalAlpha = 1;
|
|
7369
7403
|
return {
|
|
7370
7404
|
xThumbRect,
|
|
7371
7405
|
yThumbRect
|
|
7372
7406
|
};
|
|
7373
7407
|
}
|
|
7374
7408
|
function drawScroller(ctx, opts) {
|
|
7375
|
-
const { snapshot } = opts;
|
|
7409
|
+
const { snapshot, style } = opts;
|
|
7376
7410
|
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
7377
7411
|
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
7378
7412
|
const scrollInfo = getScrollInfoFromSnapshot(snapshot);
|
|
7379
|
-
const { xThumbRect, yThumbRect } = drawScrollerInfo(ctx, { viewSizeInfo, viewScaleInfo, scrollInfo });
|
|
7413
|
+
const { xThumbRect, yThumbRect } = drawScrollerInfo(ctx, { viewSizeInfo, viewScaleInfo, scrollInfo, style });
|
|
7380
7414
|
return { xThumbRect, yThumbRect };
|
|
7381
7415
|
}
|
|
7382
|
-
const MiddlewareScroller = (opts) => {
|
|
7416
|
+
const MiddlewareScroller = (opts, config) => {
|
|
7383
7417
|
const { viewer, boardContent, sharer, eventHub } = opts;
|
|
7384
7418
|
const { overlayContext } = boardContent;
|
|
7385
7419
|
sharer.setSharedStorage(keyXThumbRect, null);
|
|
7386
7420
|
sharer.setSharedStorage(keyYThumbRect, null);
|
|
7387
7421
|
let isBusy = false;
|
|
7422
|
+
const innerConfig = {
|
|
7423
|
+
...defaultStyle$1,
|
|
7424
|
+
...config
|
|
7425
|
+
};
|
|
7426
|
+
const { thumbBackground, thumbBorderColor, hoverThumbBackground, hoverThumbBorderColor, activeThumbBackground, activeThumbBorderColor } = innerConfig;
|
|
7427
|
+
const style = {
|
|
7428
|
+
thumbBackground,
|
|
7429
|
+
thumbBorderColor,
|
|
7430
|
+
hoverThumbBackground,
|
|
7431
|
+
hoverThumbBorderColor,
|
|
7432
|
+
activeThumbBackground,
|
|
7433
|
+
activeThumbBorderColor
|
|
7434
|
+
};
|
|
7388
7435
|
const clear = () => {
|
|
7389
7436
|
sharer.setSharedStorage(keyPrevPoint$1, null);
|
|
7390
7437
|
sharer.setSharedStorage(keyActivePoint, null);
|
|
@@ -7488,7 +7535,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7488
7535
|
}
|
|
7489
7536
|
},
|
|
7490
7537
|
beforeDrawFrame({ snapshot }) {
|
|
7491
|
-
const { xThumbRect, yThumbRect } = drawScroller(overlayContext, { snapshot });
|
|
7538
|
+
const { xThumbRect, yThumbRect } = drawScroller(overlayContext, { snapshot, style });
|
|
7492
7539
|
sharer.setSharedStorage(keyXThumbRect, xThumbRect);
|
|
7493
7540
|
sharer.setSharedStorage(keyYThumbRect, yThumbRect);
|
|
7494
7541
|
}
|
|
@@ -7522,17 +7569,26 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7522
7569
|
};
|
|
7523
7570
|
};
|
|
7524
7571
|
const rulerSize = 16;
|
|
7572
|
+
const fontSize = 10;
|
|
7573
|
+
const fontWeight = 100;
|
|
7574
|
+
const lineSize = 1;
|
|
7575
|
+
const fontFamily$1 = "monospace";
|
|
7525
7576
|
const background = "#FFFFFFA8";
|
|
7526
7577
|
const borderColor = "#00000080";
|
|
7527
7578
|
const scaleColor = "#000000";
|
|
7528
7579
|
const textColor = "#00000080";
|
|
7529
|
-
const fontFamily$1 = "monospace";
|
|
7530
|
-
const fontSize = 10;
|
|
7531
|
-
const fontWeight = 100;
|
|
7532
7580
|
const gridColor = "#AAAAAA20";
|
|
7533
|
-
const
|
|
7534
|
-
const lineSize = 1;
|
|
7581
|
+
const gridPrimaryColor = "#AAAAAA40";
|
|
7535
7582
|
const selectedAreaColor = "#196097";
|
|
7583
|
+
const defaultStyle = {
|
|
7584
|
+
background,
|
|
7585
|
+
borderColor,
|
|
7586
|
+
scaleColor,
|
|
7587
|
+
textColor,
|
|
7588
|
+
gridColor,
|
|
7589
|
+
gridPrimaryColor,
|
|
7590
|
+
selectedAreaColor
|
|
7591
|
+
};
|
|
7536
7592
|
const limitRulerUnitList = [1, 2, 5, 10, 20, 50, 100, 200, 500];
|
|
7537
7593
|
function limitRulerUnit(unit) {
|
|
7538
7594
|
unit = Math.max(limitRulerUnitList[0], Math.min(unit, limitRulerUnitList[limitRulerUnitList.length - 1]));
|
|
@@ -7609,7 +7665,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7609
7665
|
});
|
|
7610
7666
|
}
|
|
7611
7667
|
function drawXRuler(ctx, opts) {
|
|
7612
|
-
const { scaleList } = opts;
|
|
7668
|
+
const { scaleList, style } = opts;
|
|
7669
|
+
const { scaleColor: scaleColor2, textColor: textColor2 } = style;
|
|
7613
7670
|
const scaleDrawStart = rulerSize;
|
|
7614
7671
|
const scaleDrawEnd = rulerSize * 4 / 5;
|
|
7615
7672
|
const subKeyScaleDrawEnd = rulerSize * 2 / 5;
|
|
@@ -7626,10 +7683,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7626
7683
|
ctx.closePath();
|
|
7627
7684
|
ctx.lineWidth = lineSize;
|
|
7628
7685
|
ctx.setLineDash([]);
|
|
7629
|
-
ctx.fillStyle =
|
|
7686
|
+
ctx.fillStyle = scaleColor2;
|
|
7630
7687
|
ctx.stroke();
|
|
7631
7688
|
if (item.isKeyNum) {
|
|
7632
|
-
ctx.fillStyle =
|
|
7689
|
+
ctx.fillStyle = textColor2;
|
|
7633
7690
|
ctx.textBaseline = "top";
|
|
7634
7691
|
ctx.$setFont({
|
|
7635
7692
|
fontWeight,
|
|
@@ -7641,7 +7698,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7641
7698
|
}
|
|
7642
7699
|
}
|
|
7643
7700
|
function drawYRuler(ctx, opts) {
|
|
7644
|
-
const { scaleList } = opts;
|
|
7701
|
+
const { scaleList, style } = opts;
|
|
7702
|
+
const { scaleColor: scaleColor2, textColor: textColor2 } = style;
|
|
7645
7703
|
const scaleDrawStart = rulerSize;
|
|
7646
7704
|
const scaleDrawEnd = rulerSize * 4 / 5;
|
|
7647
7705
|
const subKeyScaleDrawEnd = rulerSize * 2 / 5;
|
|
@@ -7656,7 +7714,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7656
7714
|
ctx.moveTo(scaleDrawStart, item.position);
|
|
7657
7715
|
ctx.lineTo(item.isKeyNum ? keyScaleDrawEnd : item.isSubKeyNum ? subKeyScaleDrawEnd : scaleDrawEnd, item.position);
|
|
7658
7716
|
ctx.closePath();
|
|
7659
|
-
ctx.fillStyle =
|
|
7717
|
+
ctx.fillStyle = scaleColor2;
|
|
7660
7718
|
ctx.lineWidth = lineSize;
|
|
7661
7719
|
ctx.setLineDash([]);
|
|
7662
7720
|
ctx.stroke();
|
|
@@ -7665,7 +7723,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7665
7723
|
const textY = item.position + fontStart;
|
|
7666
7724
|
const numText = `${item.num}`;
|
|
7667
7725
|
rotateByCenter(ctx, -90, { x: textX, y: textY }, () => {
|
|
7668
|
-
ctx.fillStyle =
|
|
7726
|
+
ctx.fillStyle = textColor2;
|
|
7669
7727
|
ctx.textBaseline = "top";
|
|
7670
7728
|
ctx.$setFont({
|
|
7671
7729
|
fontWeight,
|
|
@@ -7678,8 +7736,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7678
7736
|
}
|
|
7679
7737
|
}
|
|
7680
7738
|
function drawRulerBackground(ctx, opts) {
|
|
7681
|
-
const { viewSizeInfo } = opts;
|
|
7739
|
+
const { viewSizeInfo, style } = opts;
|
|
7682
7740
|
const { width, height } = viewSizeInfo;
|
|
7741
|
+
const { background: background2, borderColor: borderColor2 } = style;
|
|
7683
7742
|
ctx.beginPath();
|
|
7684
7743
|
ctx.moveTo(0, 0);
|
|
7685
7744
|
ctx.lineTo(width + 1, 0);
|
|
@@ -7689,25 +7748,26 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7689
7748
|
ctx.lineTo(0, height + 1);
|
|
7690
7749
|
ctx.lineTo(0, 0);
|
|
7691
7750
|
ctx.closePath();
|
|
7692
|
-
ctx.fillStyle =
|
|
7751
|
+
ctx.fillStyle = background2;
|
|
7693
7752
|
ctx.fill();
|
|
7694
7753
|
ctx.lineWidth = lineSize;
|
|
7695
7754
|
ctx.setLineDash([]);
|
|
7696
|
-
ctx.strokeStyle =
|
|
7755
|
+
ctx.strokeStyle = borderColor2;
|
|
7697
7756
|
ctx.stroke();
|
|
7698
7757
|
}
|
|
7699
7758
|
function drawGrid(ctx, opts) {
|
|
7700
|
-
const { xList, yList, viewSizeInfo } = opts;
|
|
7759
|
+
const { xList, yList, viewSizeInfo, style } = opts;
|
|
7701
7760
|
const { width, height } = viewSizeInfo;
|
|
7761
|
+
const { gridColor: gridColor2, gridPrimaryColor: gridPrimaryColor2 } = style;
|
|
7702
7762
|
for (let i = 0; i < xList.length; i++) {
|
|
7703
7763
|
const item = xList[i];
|
|
7704
7764
|
ctx.beginPath();
|
|
7705
7765
|
ctx.moveTo(item.position, 0);
|
|
7706
7766
|
ctx.lineTo(item.position, height);
|
|
7707
7767
|
if (item.isKeyNum === true || item.isSubKeyNum === true) {
|
|
7708
|
-
ctx.strokeStyle =
|
|
7768
|
+
ctx.strokeStyle = gridPrimaryColor2;
|
|
7709
7769
|
} else {
|
|
7710
|
-
ctx.strokeStyle =
|
|
7770
|
+
ctx.strokeStyle = gridColor2;
|
|
7711
7771
|
}
|
|
7712
7772
|
ctx.closePath();
|
|
7713
7773
|
ctx.lineWidth = lineSize;
|
|
@@ -7720,9 +7780,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7720
7780
|
ctx.moveTo(0, item.position);
|
|
7721
7781
|
ctx.lineTo(width, item.position);
|
|
7722
7782
|
if (item.isKeyNum === true || item.isSubKeyNum === true) {
|
|
7723
|
-
ctx.strokeStyle =
|
|
7783
|
+
ctx.strokeStyle = gridPrimaryColor2;
|
|
7724
7784
|
} else {
|
|
7725
|
-
ctx.strokeStyle =
|
|
7785
|
+
ctx.strokeStyle = gridColor2;
|
|
7726
7786
|
}
|
|
7727
7787
|
ctx.lineWidth = 1;
|
|
7728
7788
|
ctx.closePath();
|
|
@@ -7730,8 +7790,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7730
7790
|
}
|
|
7731
7791
|
}
|
|
7732
7792
|
function drawScrollerSelectedArea(ctx, opts) {
|
|
7733
|
-
const { snapshot, calculator } = opts;
|
|
7793
|
+
const { snapshot, calculator, style } = opts;
|
|
7734
7794
|
const { sharedStore } = snapshot;
|
|
7795
|
+
const { selectedAreaColor: selectedAreaColor2 } = style;
|
|
7735
7796
|
const selectedElementList = sharedStore[keySelectedElementList];
|
|
7736
7797
|
const actionType = sharedStore[keyActionType];
|
|
7737
7798
|
if (["select", "drag", "drag-list", "drag-list-end"].includes(actionType) && selectedElementList.length > 0) {
|
|
@@ -7768,7 +7829,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7768
7829
|
ctx.lineTo(xAreaEnd, 0);
|
|
7769
7830
|
ctx.lineTo(xAreaEnd, rulerSize);
|
|
7770
7831
|
ctx.lineTo(xAreaStart, rulerSize);
|
|
7771
|
-
ctx.fillStyle =
|
|
7832
|
+
ctx.fillStyle = selectedAreaColor2;
|
|
7772
7833
|
ctx.closePath();
|
|
7773
7834
|
ctx.fill();
|
|
7774
7835
|
ctx.beginPath();
|
|
@@ -7776,15 +7837,29 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7776
7837
|
ctx.lineTo(rulerSize, yAreaStart);
|
|
7777
7838
|
ctx.lineTo(rulerSize, yAreaEnd);
|
|
7778
7839
|
ctx.lineTo(0, yAreaEnd);
|
|
7779
|
-
ctx.fillStyle =
|
|
7840
|
+
ctx.fillStyle = selectedAreaColor2;
|
|
7780
7841
|
ctx.closePath();
|
|
7781
7842
|
ctx.fill();
|
|
7782
7843
|
}
|
|
7783
7844
|
}
|
|
7784
7845
|
const middlewareEventRuler = "@middleware/show-ruler";
|
|
7785
|
-
const MiddlewareRuler = (opts) => {
|
|
7846
|
+
const MiddlewareRuler = (opts, config) => {
|
|
7786
7847
|
const { boardContent, viewer, eventHub, calculator } = opts;
|
|
7787
7848
|
const { overlayContext, underlayContext } = boardContent;
|
|
7849
|
+
const innerConfig = {
|
|
7850
|
+
...defaultStyle,
|
|
7851
|
+
...config
|
|
7852
|
+
};
|
|
7853
|
+
const { background: background2, borderColor: borderColor2, scaleColor: scaleColor2, textColor: textColor2, gridColor: gridColor2, gridPrimaryColor: gridPrimaryColor2, selectedAreaColor: selectedAreaColor2 } = innerConfig;
|
|
7854
|
+
const style = {
|
|
7855
|
+
background: background2,
|
|
7856
|
+
borderColor: borderColor2,
|
|
7857
|
+
scaleColor: scaleColor2,
|
|
7858
|
+
textColor: textColor2,
|
|
7859
|
+
gridColor: gridColor2,
|
|
7860
|
+
gridPrimaryColor: gridPrimaryColor2,
|
|
7861
|
+
selectedAreaColor: selectedAreaColor2
|
|
7862
|
+
};
|
|
7788
7863
|
let show = true;
|
|
7789
7864
|
let showGrid = true;
|
|
7790
7865
|
const rulerCallback = (e) => {
|
|
@@ -7810,19 +7885,20 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7810
7885
|
if (show === true) {
|
|
7811
7886
|
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
7812
7887
|
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
7813
|
-
drawScrollerSelectedArea(overlayContext, { snapshot, calculator });
|
|
7814
|
-
drawRulerBackground(overlayContext, { viewScaleInfo, viewSizeInfo });
|
|
7888
|
+
drawScrollerSelectedArea(overlayContext, { snapshot, calculator, style });
|
|
7889
|
+
drawRulerBackground(overlayContext, { viewScaleInfo, viewSizeInfo, style });
|
|
7815
7890
|
const { list: xList, rulerUnit } = calcXRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
7816
|
-
drawXRuler(overlayContext, { scaleList: xList });
|
|
7891
|
+
drawXRuler(overlayContext, { scaleList: xList, style });
|
|
7817
7892
|
const { list: yList } = calcYRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
7818
|
-
drawYRuler(overlayContext, { scaleList: yList });
|
|
7893
|
+
drawYRuler(overlayContext, { scaleList: yList, style });
|
|
7819
7894
|
if (showGrid === true) {
|
|
7820
7895
|
const ctx = rulerUnit === 1 ? overlayContext : underlayContext;
|
|
7821
7896
|
drawGrid(ctx, {
|
|
7822
7897
|
xList,
|
|
7823
7898
|
yList,
|
|
7824
7899
|
viewScaleInfo,
|
|
7825
|
-
viewSizeInfo
|
|
7900
|
+
viewSizeInfo,
|
|
7901
|
+
style
|
|
7826
7902
|
});
|
|
7827
7903
|
}
|
|
7828
7904
|
}
|
|
@@ -7874,7 +7950,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7874
7950
|
};
|
|
7875
7951
|
const fontFamily = "monospace";
|
|
7876
7952
|
function drawSizeInfoText(ctx, opts) {
|
|
7877
|
-
const { point, rotateCenter, angle: angle2, text: text2,
|
|
7953
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
7954
|
+
const { textColor: textColor2, textBackground } = style;
|
|
7878
7955
|
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
7879
7956
|
ctx.$setFont({
|
|
7880
7957
|
fontWeight: "300",
|
|
@@ -7896,7 +7973,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7896
7973
|
y: point.y
|
|
7897
7974
|
};
|
|
7898
7975
|
ctx.setLineDash([]);
|
|
7899
|
-
ctx.fillStyle =
|
|
7976
|
+
ctx.fillStyle = textBackground;
|
|
7900
7977
|
ctx.beginPath();
|
|
7901
7978
|
ctx.moveTo(bgStart.x, bgStart.y);
|
|
7902
7979
|
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
@@ -7904,13 +7981,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7904
7981
|
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
7905
7982
|
ctx.closePath();
|
|
7906
7983
|
ctx.fill();
|
|
7907
|
-
ctx.fillStyle =
|
|
7984
|
+
ctx.fillStyle = textColor2;
|
|
7908
7985
|
ctx.textBaseline = "top";
|
|
7909
7986
|
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
7910
7987
|
});
|
|
7911
7988
|
}
|
|
7912
7989
|
function drawPositionInfoText(ctx, opts) {
|
|
7913
|
-
const { point, rotateCenter, angle: angle2, text: text2,
|
|
7990
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
7991
|
+
const { textBackground, textColor: textColor2 } = style;
|
|
7914
7992
|
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
7915
7993
|
ctx.$setFont({
|
|
7916
7994
|
fontWeight: "300",
|
|
@@ -7932,7 +8010,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7932
8010
|
y: point.y
|
|
7933
8011
|
};
|
|
7934
8012
|
ctx.setLineDash([]);
|
|
7935
|
-
ctx.fillStyle =
|
|
8013
|
+
ctx.fillStyle = textBackground;
|
|
7936
8014
|
ctx.beginPath();
|
|
7937
8015
|
ctx.moveTo(bgStart.x, bgStart.y);
|
|
7938
8016
|
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
@@ -7940,13 +8018,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7940
8018
|
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
7941
8019
|
ctx.closePath();
|
|
7942
8020
|
ctx.fill();
|
|
7943
|
-
ctx.fillStyle =
|
|
8021
|
+
ctx.fillStyle = textColor2;
|
|
7944
8022
|
ctx.textBaseline = "top";
|
|
7945
8023
|
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
7946
8024
|
});
|
|
7947
8025
|
}
|
|
7948
8026
|
function drawAngleInfoText(ctx, opts) {
|
|
7949
|
-
const { point, rotateCenter, angle: angle2, text: text2,
|
|
8027
|
+
const { point, rotateCenter, angle: angle2, text: text2, style, fontSize: fontSize2, lineHeight: lineHeight2 } = opts;
|
|
8028
|
+
const { textBackground, textColor: textColor2 } = style;
|
|
7950
8029
|
rotateByCenter(ctx, angle2, rotateCenter, () => {
|
|
7951
8030
|
ctx.$setFont({
|
|
7952
8031
|
fontWeight: "300",
|
|
@@ -7968,7 +8047,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7968
8047
|
y: point.y
|
|
7969
8048
|
};
|
|
7970
8049
|
ctx.setLineDash([]);
|
|
7971
|
-
ctx.fillStyle =
|
|
8050
|
+
ctx.fillStyle = textBackground;
|
|
7972
8051
|
ctx.beginPath();
|
|
7973
8052
|
ctx.moveTo(bgStart.x, bgStart.y);
|
|
7974
8053
|
ctx.lineTo(bgEnd.x, bgStart.y);
|
|
@@ -7976,18 +8055,31 @@ var __privateMethod = (obj, member, method) => {
|
|
|
7976
8055
|
ctx.lineTo(bgStart.x, bgEnd.y);
|
|
7977
8056
|
ctx.closePath();
|
|
7978
8057
|
ctx.fill();
|
|
7979
|
-
ctx.fillStyle =
|
|
8058
|
+
ctx.fillStyle = textColor2;
|
|
7980
8059
|
ctx.textBaseline = "top";
|
|
7981
8060
|
ctx.fillText(text2, textStart.x, textStart.y + padding);
|
|
7982
8061
|
});
|
|
7983
8062
|
}
|
|
7984
8063
|
const infoBackground = "#1973bac6";
|
|
7985
8064
|
const infoTextColor = "#ffffff";
|
|
8065
|
+
const defaltStyle = {
|
|
8066
|
+
textBackground: infoBackground,
|
|
8067
|
+
textColor: infoTextColor
|
|
8068
|
+
};
|
|
7986
8069
|
const infoFontSize = 10;
|
|
7987
8070
|
const infoLineHeight = 16;
|
|
7988
|
-
const MiddlewareInfo = (opts) => {
|
|
8071
|
+
const MiddlewareInfo = (opts, config) => {
|
|
7989
8072
|
const { boardContent, calculator } = opts;
|
|
7990
8073
|
const { overlayContext } = boardContent;
|
|
8074
|
+
const innerConfig = {
|
|
8075
|
+
...defaltStyle,
|
|
8076
|
+
...config
|
|
8077
|
+
};
|
|
8078
|
+
const { textBackground, textColor: textColor2 } = innerConfig;
|
|
8079
|
+
const style = {
|
|
8080
|
+
textBackground,
|
|
8081
|
+
textColor: textColor2
|
|
8082
|
+
};
|
|
7991
8083
|
return {
|
|
7992
8084
|
name: "@middleware/info",
|
|
7993
8085
|
beforeDrawFrame({ snapshot }) {
|
|
@@ -8053,8 +8145,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8053
8145
|
text: whText,
|
|
8054
8146
|
fontSize: infoFontSize,
|
|
8055
8147
|
lineHeight: infoLineHeight,
|
|
8056
|
-
|
|
8057
|
-
background: infoBackground
|
|
8148
|
+
style
|
|
8058
8149
|
});
|
|
8059
8150
|
drawPositionInfoText(overlayContext, {
|
|
8060
8151
|
point: {
|
|
@@ -8066,8 +8157,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8066
8157
|
text: xyText,
|
|
8067
8158
|
fontSize: infoFontSize,
|
|
8068
8159
|
lineHeight: infoLineHeight,
|
|
8069
|
-
|
|
8070
|
-
background: infoBackground
|
|
8160
|
+
style
|
|
8071
8161
|
});
|
|
8072
8162
|
drawAngleInfoText(overlayContext, {
|
|
8073
8163
|
point: {
|
|
@@ -8079,8 +8169,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8079
8169
|
text: angleText,
|
|
8080
8170
|
fontSize: infoFontSize,
|
|
8081
8171
|
lineHeight: infoLineHeight,
|
|
8082
|
-
|
|
8083
|
-
background: infoBackground
|
|
8172
|
+
style
|
|
8084
8173
|
});
|
|
8085
8174
|
}
|
|
8086
8175
|
}
|
|
@@ -8125,8 +8214,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
8125
8214
|
__privateGet(this, _board).destroy();
|
|
8126
8215
|
__privateGet(this, _canvas).remove();
|
|
8127
8216
|
}
|
|
8128
|
-
use(middleware) {
|
|
8129
|
-
__privateGet(this, _board).use(middleware);
|
|
8217
|
+
use(middleware, config) {
|
|
8218
|
+
__privateGet(this, _board).use(middleware, config);
|
|
8130
8219
|
}
|
|
8131
8220
|
disuse(middleware) {
|
|
8132
8221
|
__privateGet(this, _board).disuse(middleware);
|