microboard-temp 0.14.26 → 0.14.28
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/cjs/browser.js +30 -18
- package/dist/cjs/index.js +30 -18
- package/dist/cjs/node.js +30 -18
- package/dist/esm/browser.js +30 -18
- package/dist/esm/index.js +30 -18
- package/dist/esm/node.js +30 -18
- package/dist/types/Items/BaseItem/BaseItem.d.ts +3 -0
- package/dist/types/Items/Drawing/Drawing.d.ts +1 -1
- package/dist/types/Items/Drawing/Drawing.schema.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -11945,6 +11945,7 @@ class BaseItem {
|
|
|
11945
11945
|
shouldUseRelativeAlignment = true;
|
|
11946
11946
|
resizeEnabled = true;
|
|
11947
11947
|
onlyProportionalResize = false;
|
|
11948
|
+
opacity = 1;
|
|
11948
11949
|
itemType = "";
|
|
11949
11950
|
childIds = [];
|
|
11950
11951
|
isHoverHighlighted = false;
|
|
@@ -12297,6 +12298,7 @@ class BaseItem {
|
|
|
12297
12298
|
itemType: this.itemType,
|
|
12298
12299
|
childIds: this.childIds,
|
|
12299
12300
|
parent: this.parent,
|
|
12301
|
+
opacity: this.opacity,
|
|
12300
12302
|
resizeEnabled: this.resizeEnabled
|
|
12301
12303
|
};
|
|
12302
12304
|
}
|
|
@@ -12508,6 +12510,16 @@ class BaseItem {
|
|
|
12508
12510
|
this.index.render(context);
|
|
12509
12511
|
}
|
|
12510
12512
|
}
|
|
12513
|
+
renderWithOpacity(context) {
|
|
12514
|
+
if (this.opacity === 1) {
|
|
12515
|
+
this.render(context);
|
|
12516
|
+
return;
|
|
12517
|
+
}
|
|
12518
|
+
context.ctx.save();
|
|
12519
|
+
context.ctx.globalAlpha *= this.opacity;
|
|
12520
|
+
this.render(context);
|
|
12521
|
+
context.ctx.restore();
|
|
12522
|
+
}
|
|
12511
12523
|
getSnapAnchorPoints() {
|
|
12512
12524
|
return this.getMbr().getSnapAnchorPoints();
|
|
12513
12525
|
}
|
|
@@ -40919,7 +40931,9 @@ function registerHTMLRenderer(itemType, renderer) {
|
|
|
40919
40931
|
}
|
|
40920
40932
|
function renderItemToHTML(item, documentFactory) {
|
|
40921
40933
|
const renderer = renderers[item.itemType] || defaultRenderer;
|
|
40922
|
-
|
|
40934
|
+
const element2 = renderer.render(item, documentFactory);
|
|
40935
|
+
element2.style.opacity = `${item.opacity}`;
|
|
40936
|
+
return element2;
|
|
40923
40937
|
}
|
|
40924
40938
|
var defaultRenderer = {
|
|
40925
40939
|
render(item, documentFactory) {
|
|
@@ -43143,7 +43157,7 @@ class DrawingHTMLRenderer {
|
|
|
43143
43157
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
43144
43158
|
pathElement.setAttribute("d", this.getPathData(drawing));
|
|
43145
43159
|
pathElement.setAttribute("stroke", resolveColor(drawing.borderColor, conf.theme, drawing.colorRole));
|
|
43146
|
-
pathElement.setAttribute("stroke-opacity", `${drawing.
|
|
43160
|
+
pathElement.setAttribute("stroke-opacity", `${drawing.opacity}`);
|
|
43147
43161
|
pathElement.setAttribute("stroke-width", `${drawing.strokeWidth}`);
|
|
43148
43162
|
pathElement.setAttribute("fill", "none");
|
|
43149
43163
|
svg.appendChild(pathElement);
|
|
@@ -44206,7 +44220,7 @@ class SimpleSpatialIndex {
|
|
|
44206
44220
|
}
|
|
44207
44221
|
render(context) {
|
|
44208
44222
|
this.itemsArray.forEach((item) => {
|
|
44209
|
-
item.render(context);
|
|
44223
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
44210
44224
|
});
|
|
44211
44225
|
}
|
|
44212
44226
|
}
|
|
@@ -60523,7 +60537,7 @@ async function exportBoardScreenshot({
|
|
|
60523
60537
|
const { left, top, right, bottom } = selection;
|
|
60524
60538
|
const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
60525
60539
|
for (const item of inView) {
|
|
60526
|
-
item.render(context);
|
|
60540
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
60527
60541
|
}
|
|
60528
60542
|
const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
|
|
60529
60543
|
const dataUrl = await convertBlobToDataUrl(blob);
|
|
@@ -62978,6 +62992,7 @@ var DrawingDataSchema = exports_external.object({
|
|
|
62978
62992
|
strokeStyle: ColorValueSchema,
|
|
62979
62993
|
strokeWidth: exports_external.number(),
|
|
62980
62994
|
colorRole: exports_external.enum(["foreground", "background"]).optional(),
|
|
62995
|
+
opacity: exports_external.number().optional(),
|
|
62981
62996
|
linkTo: exports_external.string().optional()
|
|
62982
62997
|
});
|
|
62983
62998
|
|
|
@@ -62994,7 +63009,6 @@ class Drawing extends BaseItem {
|
|
|
62994
63009
|
borderStyle = "solid";
|
|
62995
63010
|
colorRole = "foreground";
|
|
62996
63011
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
62997
|
-
borderOpacity = 1;
|
|
62998
63012
|
transformationRenderBlock = undefined;
|
|
62999
63013
|
points = [];
|
|
63000
63014
|
constructor(board, id = "") {
|
|
@@ -63008,14 +63022,12 @@ class Drawing extends BaseItem {
|
|
|
63008
63022
|
points.push({ x: point5.x, y: point5.y });
|
|
63009
63023
|
}
|
|
63010
63024
|
return {
|
|
63011
|
-
|
|
63025
|
+
...super.serialize(),
|
|
63012
63026
|
itemType: "Drawing",
|
|
63013
63027
|
points,
|
|
63014
|
-
transformation: this.transformation.serialize(),
|
|
63015
63028
|
strokeStyle: this.borderColor,
|
|
63016
63029
|
strokeWidth: this.strokeWidth,
|
|
63017
|
-
colorRole: this.colorRole
|
|
63018
|
-
linkTo: this.linkTo.serialize()
|
|
63030
|
+
colorRole: this.colorRole
|
|
63019
63031
|
};
|
|
63020
63032
|
}
|
|
63021
63033
|
deserialize(data) {
|
|
@@ -63033,6 +63045,7 @@ class Drawing extends BaseItem {
|
|
|
63033
63045
|
if (data.colorRole) {
|
|
63034
63046
|
this.colorRole = data.colorRole;
|
|
63035
63047
|
}
|
|
63048
|
+
this.opacity = data.opacity ?? this.opacity;
|
|
63036
63049
|
this.updateVisuals({ method: "deserialize", class: this.itemType }, "FullRebuild" /* FullRebuild */);
|
|
63037
63050
|
return this;
|
|
63038
63051
|
}
|
|
@@ -63147,7 +63160,6 @@ class Drawing extends BaseItem {
|
|
|
63147
63160
|
const ctx = context.ctx;
|
|
63148
63161
|
ctx.save();
|
|
63149
63162
|
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
|
|
63150
|
-
ctx.globalAlpha = this.borderOpacity;
|
|
63151
63163
|
ctx.lineWidth = this.strokeWidth;
|
|
63152
63164
|
ctx.lineCap = "round";
|
|
63153
63165
|
ctx.setLineDash(this.linePattern);
|
|
@@ -63277,7 +63289,7 @@ class Drawing extends BaseItem {
|
|
|
63277
63289
|
"borderColor",
|
|
63278
63290
|
"strokeWidth",
|
|
63279
63291
|
"borderStyle",
|
|
63280
|
-
"
|
|
63292
|
+
"opacity",
|
|
63281
63293
|
"colorRole",
|
|
63282
63294
|
"strokeStyle"
|
|
63283
63295
|
];
|
|
@@ -63287,7 +63299,7 @@ class Drawing extends BaseItem {
|
|
|
63287
63299
|
return super.getPropertyUpdateHint(property);
|
|
63288
63300
|
}
|
|
63289
63301
|
getStrokeOpacity() {
|
|
63290
|
-
return this.
|
|
63302
|
+
return this.opacity;
|
|
63291
63303
|
}
|
|
63292
63304
|
getBorderStyle() {
|
|
63293
63305
|
return this.borderStyle;
|
|
@@ -63333,7 +63345,7 @@ registerItem({
|
|
|
63333
63345
|
itemType: "Drawing",
|
|
63334
63346
|
points: [],
|
|
63335
63347
|
borderColor: coerceColorValue("#000000"),
|
|
63336
|
-
|
|
63348
|
+
opacity: 1,
|
|
63337
63349
|
borderStyle: "solid",
|
|
63338
63350
|
strokeWidth: 2,
|
|
63339
63351
|
transformation: new DefaultTransformationData
|
|
@@ -64355,7 +64367,7 @@ class ShapeTool extends CustomTool {
|
|
|
64355
64367
|
}
|
|
64356
64368
|
render(context) {
|
|
64357
64369
|
if (this.isDown) {
|
|
64358
|
-
this.item.
|
|
64370
|
+
this.item.renderWithOpacity(context);
|
|
64359
64371
|
this.bounds.render(context);
|
|
64360
64372
|
}
|
|
64361
64373
|
}
|
|
@@ -68841,13 +68853,13 @@ function createCanvasDrawer(board) {
|
|
|
68841
68853
|
if (container2) {
|
|
68842
68854
|
context.ctx.save();
|
|
68843
68855
|
container2.getNestingMatrix().applyToContext(context.ctx);
|
|
68844
|
-
item.
|
|
68856
|
+
item.renderWithOpacity(context);
|
|
68845
68857
|
context.ctx.restore();
|
|
68846
68858
|
} else {
|
|
68847
|
-
item.
|
|
68859
|
+
item.renderWithOpacity(context);
|
|
68848
68860
|
}
|
|
68849
68861
|
} else {
|
|
68850
|
-
item.
|
|
68862
|
+
item.renderWithOpacity(context);
|
|
68851
68863
|
}
|
|
68852
68864
|
board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
|
|
68853
68865
|
}
|
|
@@ -73315,7 +73327,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
73315
73327
|
}
|
|
73316
73328
|
applyDrawingRole(drawing) {
|
|
73317
73329
|
drawing.setColorRole("background");
|
|
73318
|
-
drawing.apply(propertyOps.setProperty([drawing], "
|
|
73330
|
+
drawing.apply(propertyOps.setProperty([drawing], "opacity", 0.5));
|
|
73319
73331
|
}
|
|
73320
73332
|
updateSettings() {
|
|
73321
73333
|
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
package/dist/cjs/index.js
CHANGED
|
@@ -11945,6 +11945,7 @@ class BaseItem {
|
|
|
11945
11945
|
shouldUseRelativeAlignment = true;
|
|
11946
11946
|
resizeEnabled = true;
|
|
11947
11947
|
onlyProportionalResize = false;
|
|
11948
|
+
opacity = 1;
|
|
11948
11949
|
itemType = "";
|
|
11949
11950
|
childIds = [];
|
|
11950
11951
|
isHoverHighlighted = false;
|
|
@@ -12297,6 +12298,7 @@ class BaseItem {
|
|
|
12297
12298
|
itemType: this.itemType,
|
|
12298
12299
|
childIds: this.childIds,
|
|
12299
12300
|
parent: this.parent,
|
|
12301
|
+
opacity: this.opacity,
|
|
12300
12302
|
resizeEnabled: this.resizeEnabled
|
|
12301
12303
|
};
|
|
12302
12304
|
}
|
|
@@ -12508,6 +12510,16 @@ class BaseItem {
|
|
|
12508
12510
|
this.index.render(context);
|
|
12509
12511
|
}
|
|
12510
12512
|
}
|
|
12513
|
+
renderWithOpacity(context) {
|
|
12514
|
+
if (this.opacity === 1) {
|
|
12515
|
+
this.render(context);
|
|
12516
|
+
return;
|
|
12517
|
+
}
|
|
12518
|
+
context.ctx.save();
|
|
12519
|
+
context.ctx.globalAlpha *= this.opacity;
|
|
12520
|
+
this.render(context);
|
|
12521
|
+
context.ctx.restore();
|
|
12522
|
+
}
|
|
12511
12523
|
getSnapAnchorPoints() {
|
|
12512
12524
|
return this.getMbr().getSnapAnchorPoints();
|
|
12513
12525
|
}
|
|
@@ -40919,7 +40931,9 @@ function registerHTMLRenderer(itemType, renderer) {
|
|
|
40919
40931
|
}
|
|
40920
40932
|
function renderItemToHTML(item, documentFactory) {
|
|
40921
40933
|
const renderer = renderers[item.itemType] || defaultRenderer;
|
|
40922
|
-
|
|
40934
|
+
const element2 = renderer.render(item, documentFactory);
|
|
40935
|
+
element2.style.opacity = `${item.opacity}`;
|
|
40936
|
+
return element2;
|
|
40923
40937
|
}
|
|
40924
40938
|
var defaultRenderer = {
|
|
40925
40939
|
render(item, documentFactory) {
|
|
@@ -43143,7 +43157,7 @@ class DrawingHTMLRenderer {
|
|
|
43143
43157
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
43144
43158
|
pathElement.setAttribute("d", this.getPathData(drawing));
|
|
43145
43159
|
pathElement.setAttribute("stroke", resolveColor(drawing.borderColor, conf.theme, drawing.colorRole));
|
|
43146
|
-
pathElement.setAttribute("stroke-opacity", `${drawing.
|
|
43160
|
+
pathElement.setAttribute("stroke-opacity", `${drawing.opacity}`);
|
|
43147
43161
|
pathElement.setAttribute("stroke-width", `${drawing.strokeWidth}`);
|
|
43148
43162
|
pathElement.setAttribute("fill", "none");
|
|
43149
43163
|
svg.appendChild(pathElement);
|
|
@@ -44206,7 +44220,7 @@ class SimpleSpatialIndex {
|
|
|
44206
44220
|
}
|
|
44207
44221
|
render(context) {
|
|
44208
44222
|
this.itemsArray.forEach((item) => {
|
|
44209
|
-
item.render(context);
|
|
44223
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
44210
44224
|
});
|
|
44211
44225
|
}
|
|
44212
44226
|
}
|
|
@@ -60523,7 +60537,7 @@ async function exportBoardScreenshot({
|
|
|
60523
60537
|
const { left, top, right, bottom } = selection;
|
|
60524
60538
|
const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
60525
60539
|
for (const item of inView) {
|
|
60526
|
-
item.render(context);
|
|
60540
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
60527
60541
|
}
|
|
60528
60542
|
const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
|
|
60529
60543
|
const dataUrl = await convertBlobToDataUrl(blob);
|
|
@@ -62978,6 +62992,7 @@ var DrawingDataSchema = exports_external.object({
|
|
|
62978
62992
|
strokeStyle: ColorValueSchema,
|
|
62979
62993
|
strokeWidth: exports_external.number(),
|
|
62980
62994
|
colorRole: exports_external.enum(["foreground", "background"]).optional(),
|
|
62995
|
+
opacity: exports_external.number().optional(),
|
|
62981
62996
|
linkTo: exports_external.string().optional()
|
|
62982
62997
|
});
|
|
62983
62998
|
|
|
@@ -62994,7 +63009,6 @@ class Drawing extends BaseItem {
|
|
|
62994
63009
|
borderStyle = "solid";
|
|
62995
63010
|
colorRole = "foreground";
|
|
62996
63011
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
62997
|
-
borderOpacity = 1;
|
|
62998
63012
|
transformationRenderBlock = undefined;
|
|
62999
63013
|
points = [];
|
|
63000
63014
|
constructor(board, id = "") {
|
|
@@ -63008,14 +63022,12 @@ class Drawing extends BaseItem {
|
|
|
63008
63022
|
points.push({ x: point5.x, y: point5.y });
|
|
63009
63023
|
}
|
|
63010
63024
|
return {
|
|
63011
|
-
|
|
63025
|
+
...super.serialize(),
|
|
63012
63026
|
itemType: "Drawing",
|
|
63013
63027
|
points,
|
|
63014
|
-
transformation: this.transformation.serialize(),
|
|
63015
63028
|
strokeStyle: this.borderColor,
|
|
63016
63029
|
strokeWidth: this.strokeWidth,
|
|
63017
|
-
colorRole: this.colorRole
|
|
63018
|
-
linkTo: this.linkTo.serialize()
|
|
63030
|
+
colorRole: this.colorRole
|
|
63019
63031
|
};
|
|
63020
63032
|
}
|
|
63021
63033
|
deserialize(data) {
|
|
@@ -63033,6 +63045,7 @@ class Drawing extends BaseItem {
|
|
|
63033
63045
|
if (data.colorRole) {
|
|
63034
63046
|
this.colorRole = data.colorRole;
|
|
63035
63047
|
}
|
|
63048
|
+
this.opacity = data.opacity ?? this.opacity;
|
|
63036
63049
|
this.updateVisuals({ method: "deserialize", class: this.itemType }, "FullRebuild" /* FullRebuild */);
|
|
63037
63050
|
return this;
|
|
63038
63051
|
}
|
|
@@ -63147,7 +63160,6 @@ class Drawing extends BaseItem {
|
|
|
63147
63160
|
const ctx = context.ctx;
|
|
63148
63161
|
ctx.save();
|
|
63149
63162
|
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
|
|
63150
|
-
ctx.globalAlpha = this.borderOpacity;
|
|
63151
63163
|
ctx.lineWidth = this.strokeWidth;
|
|
63152
63164
|
ctx.lineCap = "round";
|
|
63153
63165
|
ctx.setLineDash(this.linePattern);
|
|
@@ -63277,7 +63289,7 @@ class Drawing extends BaseItem {
|
|
|
63277
63289
|
"borderColor",
|
|
63278
63290
|
"strokeWidth",
|
|
63279
63291
|
"borderStyle",
|
|
63280
|
-
"
|
|
63292
|
+
"opacity",
|
|
63281
63293
|
"colorRole",
|
|
63282
63294
|
"strokeStyle"
|
|
63283
63295
|
];
|
|
@@ -63287,7 +63299,7 @@ class Drawing extends BaseItem {
|
|
|
63287
63299
|
return super.getPropertyUpdateHint(property);
|
|
63288
63300
|
}
|
|
63289
63301
|
getStrokeOpacity() {
|
|
63290
|
-
return this.
|
|
63302
|
+
return this.opacity;
|
|
63291
63303
|
}
|
|
63292
63304
|
getBorderStyle() {
|
|
63293
63305
|
return this.borderStyle;
|
|
@@ -63333,7 +63345,7 @@ registerItem({
|
|
|
63333
63345
|
itemType: "Drawing",
|
|
63334
63346
|
points: [],
|
|
63335
63347
|
borderColor: coerceColorValue("#000000"),
|
|
63336
|
-
|
|
63348
|
+
opacity: 1,
|
|
63337
63349
|
borderStyle: "solid",
|
|
63338
63350
|
strokeWidth: 2,
|
|
63339
63351
|
transformation: new DefaultTransformationData
|
|
@@ -64355,7 +64367,7 @@ class ShapeTool extends CustomTool {
|
|
|
64355
64367
|
}
|
|
64356
64368
|
render(context) {
|
|
64357
64369
|
if (this.isDown) {
|
|
64358
|
-
this.item.
|
|
64370
|
+
this.item.renderWithOpacity(context);
|
|
64359
64371
|
this.bounds.render(context);
|
|
64360
64372
|
}
|
|
64361
64373
|
}
|
|
@@ -68841,13 +68853,13 @@ function createCanvasDrawer(board) {
|
|
|
68841
68853
|
if (container2) {
|
|
68842
68854
|
context.ctx.save();
|
|
68843
68855
|
container2.getNestingMatrix().applyToContext(context.ctx);
|
|
68844
|
-
item.
|
|
68856
|
+
item.renderWithOpacity(context);
|
|
68845
68857
|
context.ctx.restore();
|
|
68846
68858
|
} else {
|
|
68847
|
-
item.
|
|
68859
|
+
item.renderWithOpacity(context);
|
|
68848
68860
|
}
|
|
68849
68861
|
} else {
|
|
68850
|
-
item.
|
|
68862
|
+
item.renderWithOpacity(context);
|
|
68851
68863
|
}
|
|
68852
68864
|
board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
|
|
68853
68865
|
}
|
|
@@ -73315,7 +73327,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
73315
73327
|
}
|
|
73316
73328
|
applyDrawingRole(drawing) {
|
|
73317
73329
|
drawing.setColorRole("background");
|
|
73318
|
-
drawing.apply(propertyOps.setProperty([drawing], "
|
|
73330
|
+
drawing.apply(propertyOps.setProperty([drawing], "opacity", 0.5));
|
|
73319
73331
|
}
|
|
73320
73332
|
updateSettings() {
|
|
73321
73333
|
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
package/dist/cjs/node.js
CHANGED
|
@@ -12981,6 +12981,7 @@ class BaseItem {
|
|
|
12981
12981
|
shouldUseRelativeAlignment = true;
|
|
12982
12982
|
resizeEnabled = true;
|
|
12983
12983
|
onlyProportionalResize = false;
|
|
12984
|
+
opacity = 1;
|
|
12984
12985
|
itemType = "";
|
|
12985
12986
|
childIds = [];
|
|
12986
12987
|
isHoverHighlighted = false;
|
|
@@ -13333,6 +13334,7 @@ class BaseItem {
|
|
|
13333
13334
|
itemType: this.itemType,
|
|
13334
13335
|
childIds: this.childIds,
|
|
13335
13336
|
parent: this.parent,
|
|
13337
|
+
opacity: this.opacity,
|
|
13336
13338
|
resizeEnabled: this.resizeEnabled
|
|
13337
13339
|
};
|
|
13338
13340
|
}
|
|
@@ -13544,6 +13546,16 @@ class BaseItem {
|
|
|
13544
13546
|
this.index.render(context);
|
|
13545
13547
|
}
|
|
13546
13548
|
}
|
|
13549
|
+
renderWithOpacity(context) {
|
|
13550
|
+
if (this.opacity === 1) {
|
|
13551
|
+
this.render(context);
|
|
13552
|
+
return;
|
|
13553
|
+
}
|
|
13554
|
+
context.ctx.save();
|
|
13555
|
+
context.ctx.globalAlpha *= this.opacity;
|
|
13556
|
+
this.render(context);
|
|
13557
|
+
context.ctx.restore();
|
|
13558
|
+
}
|
|
13547
13559
|
getSnapAnchorPoints() {
|
|
13548
13560
|
return this.getMbr().getSnapAnchorPoints();
|
|
13549
13561
|
}
|
|
@@ -43391,7 +43403,9 @@ function registerHTMLRenderer(itemType, renderer) {
|
|
|
43391
43403
|
}
|
|
43392
43404
|
function renderItemToHTML(item, documentFactory) {
|
|
43393
43405
|
const renderer = renderers[item.itemType] || defaultRenderer;
|
|
43394
|
-
|
|
43406
|
+
const element = renderer.render(item, documentFactory);
|
|
43407
|
+
element.style.opacity = `${item.opacity}`;
|
|
43408
|
+
return element;
|
|
43395
43409
|
}
|
|
43396
43410
|
var defaultRenderer = {
|
|
43397
43411
|
render(item, documentFactory) {
|
|
@@ -45615,7 +45629,7 @@ class DrawingHTMLRenderer {
|
|
|
45615
45629
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
45616
45630
|
pathElement.setAttribute("d", this.getPathData(drawing));
|
|
45617
45631
|
pathElement.setAttribute("stroke", resolveColor(drawing.borderColor, conf.theme, drawing.colorRole));
|
|
45618
|
-
pathElement.setAttribute("stroke-opacity", `${drawing.
|
|
45632
|
+
pathElement.setAttribute("stroke-opacity", `${drawing.opacity}`);
|
|
45619
45633
|
pathElement.setAttribute("stroke-width", `${drawing.strokeWidth}`);
|
|
45620
45634
|
pathElement.setAttribute("fill", "none");
|
|
45621
45635
|
svg.appendChild(pathElement);
|
|
@@ -46678,7 +46692,7 @@ class SimpleSpatialIndex {
|
|
|
46678
46692
|
}
|
|
46679
46693
|
render(context) {
|
|
46680
46694
|
this.itemsArray.forEach((item) => {
|
|
46681
|
-
item.render(context);
|
|
46695
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
46682
46696
|
});
|
|
46683
46697
|
}
|
|
46684
46698
|
}
|
|
@@ -62996,7 +63010,7 @@ async function exportBoardScreenshot({
|
|
|
62996
63010
|
const { left, top, right, bottom } = selection;
|
|
62997
63011
|
const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
62998
63012
|
for (const item of inView) {
|
|
62999
|
-
item.render(context);
|
|
63013
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
63000
63014
|
}
|
|
63001
63015
|
const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
|
|
63002
63016
|
const dataUrl = await convertBlobToDataUrl(blob);
|
|
@@ -65451,6 +65465,7 @@ var DrawingDataSchema = exports_external.object({
|
|
|
65451
65465
|
strokeStyle: ColorValueSchema,
|
|
65452
65466
|
strokeWidth: exports_external.number(),
|
|
65453
65467
|
colorRole: exports_external.enum(["foreground", "background"]).optional(),
|
|
65468
|
+
opacity: exports_external.number().optional(),
|
|
65454
65469
|
linkTo: exports_external.string().optional()
|
|
65455
65470
|
});
|
|
65456
65471
|
|
|
@@ -65467,7 +65482,6 @@ class Drawing extends BaseItem {
|
|
|
65467
65482
|
borderStyle = "solid";
|
|
65468
65483
|
colorRole = "foreground";
|
|
65469
65484
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
65470
|
-
borderOpacity = 1;
|
|
65471
65485
|
transformationRenderBlock = undefined;
|
|
65472
65486
|
points = [];
|
|
65473
65487
|
constructor(board, id = "") {
|
|
@@ -65481,14 +65495,12 @@ class Drawing extends BaseItem {
|
|
|
65481
65495
|
points.push({ x: point5.x, y: point5.y });
|
|
65482
65496
|
}
|
|
65483
65497
|
return {
|
|
65484
|
-
|
|
65498
|
+
...super.serialize(),
|
|
65485
65499
|
itemType: "Drawing",
|
|
65486
65500
|
points,
|
|
65487
|
-
transformation: this.transformation.serialize(),
|
|
65488
65501
|
strokeStyle: this.borderColor,
|
|
65489
65502
|
strokeWidth: this.strokeWidth,
|
|
65490
|
-
colorRole: this.colorRole
|
|
65491
|
-
linkTo: this.linkTo.serialize()
|
|
65503
|
+
colorRole: this.colorRole
|
|
65492
65504
|
};
|
|
65493
65505
|
}
|
|
65494
65506
|
deserialize(data) {
|
|
@@ -65506,6 +65518,7 @@ class Drawing extends BaseItem {
|
|
|
65506
65518
|
if (data.colorRole) {
|
|
65507
65519
|
this.colorRole = data.colorRole;
|
|
65508
65520
|
}
|
|
65521
|
+
this.opacity = data.opacity ?? this.opacity;
|
|
65509
65522
|
this.updateVisuals({ method: "deserialize", class: this.itemType }, "FullRebuild" /* FullRebuild */);
|
|
65510
65523
|
return this;
|
|
65511
65524
|
}
|
|
@@ -65620,7 +65633,6 @@ class Drawing extends BaseItem {
|
|
|
65620
65633
|
const ctx = context.ctx;
|
|
65621
65634
|
ctx.save();
|
|
65622
65635
|
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
|
|
65623
|
-
ctx.globalAlpha = this.borderOpacity;
|
|
65624
65636
|
ctx.lineWidth = this.strokeWidth;
|
|
65625
65637
|
ctx.lineCap = "round";
|
|
65626
65638
|
ctx.setLineDash(this.linePattern);
|
|
@@ -65750,7 +65762,7 @@ class Drawing extends BaseItem {
|
|
|
65750
65762
|
"borderColor",
|
|
65751
65763
|
"strokeWidth",
|
|
65752
65764
|
"borderStyle",
|
|
65753
|
-
"
|
|
65765
|
+
"opacity",
|
|
65754
65766
|
"colorRole",
|
|
65755
65767
|
"strokeStyle"
|
|
65756
65768
|
];
|
|
@@ -65760,7 +65772,7 @@ class Drawing extends BaseItem {
|
|
|
65760
65772
|
return super.getPropertyUpdateHint(property);
|
|
65761
65773
|
}
|
|
65762
65774
|
getStrokeOpacity() {
|
|
65763
|
-
return this.
|
|
65775
|
+
return this.opacity;
|
|
65764
65776
|
}
|
|
65765
65777
|
getBorderStyle() {
|
|
65766
65778
|
return this.borderStyle;
|
|
@@ -65806,7 +65818,7 @@ registerItem({
|
|
|
65806
65818
|
itemType: "Drawing",
|
|
65807
65819
|
points: [],
|
|
65808
65820
|
borderColor: coerceColorValue("#000000"),
|
|
65809
|
-
|
|
65821
|
+
opacity: 1,
|
|
65810
65822
|
borderStyle: "solid",
|
|
65811
65823
|
strokeWidth: 2,
|
|
65812
65824
|
transformation: new DefaultTransformationData
|
|
@@ -66828,7 +66840,7 @@ class ShapeTool extends CustomTool {
|
|
|
66828
66840
|
}
|
|
66829
66841
|
render(context) {
|
|
66830
66842
|
if (this.isDown) {
|
|
66831
|
-
this.item.
|
|
66843
|
+
this.item.renderWithOpacity(context);
|
|
66832
66844
|
this.bounds.render(context);
|
|
66833
66845
|
}
|
|
66834
66846
|
}
|
|
@@ -71314,13 +71326,13 @@ function createCanvasDrawer(board) {
|
|
|
71314
71326
|
if (container2) {
|
|
71315
71327
|
context.ctx.save();
|
|
71316
71328
|
container2.getNestingMatrix().applyToContext(context.ctx);
|
|
71317
|
-
item.
|
|
71329
|
+
item.renderWithOpacity(context);
|
|
71318
71330
|
context.ctx.restore();
|
|
71319
71331
|
} else {
|
|
71320
|
-
item.
|
|
71332
|
+
item.renderWithOpacity(context);
|
|
71321
71333
|
}
|
|
71322
71334
|
} else {
|
|
71323
|
-
item.
|
|
71335
|
+
item.renderWithOpacity(context);
|
|
71324
71336
|
}
|
|
71325
71337
|
board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
|
|
71326
71338
|
}
|
|
@@ -75788,7 +75800,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
75788
75800
|
}
|
|
75789
75801
|
applyDrawingRole(drawing) {
|
|
75790
75802
|
drawing.setColorRole("background");
|
|
75791
|
-
drawing.apply(propertyOps.setProperty([drawing], "
|
|
75803
|
+
drawing.apply(propertyOps.setProperty([drawing], "opacity", 0.5));
|
|
75792
75804
|
}
|
|
75793
75805
|
updateSettings() {
|
|
75794
75806
|
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
package/dist/esm/browser.js
CHANGED
|
@@ -11719,6 +11719,7 @@ class BaseItem {
|
|
|
11719
11719
|
shouldUseRelativeAlignment = true;
|
|
11720
11720
|
resizeEnabled = true;
|
|
11721
11721
|
onlyProportionalResize = false;
|
|
11722
|
+
opacity = 1;
|
|
11722
11723
|
itemType = "";
|
|
11723
11724
|
childIds = [];
|
|
11724
11725
|
isHoverHighlighted = false;
|
|
@@ -12071,6 +12072,7 @@ class BaseItem {
|
|
|
12071
12072
|
itemType: this.itemType,
|
|
12072
12073
|
childIds: this.childIds,
|
|
12073
12074
|
parent: this.parent,
|
|
12075
|
+
opacity: this.opacity,
|
|
12074
12076
|
resizeEnabled: this.resizeEnabled
|
|
12075
12077
|
};
|
|
12076
12078
|
}
|
|
@@ -12282,6 +12284,16 @@ class BaseItem {
|
|
|
12282
12284
|
this.index.render(context);
|
|
12283
12285
|
}
|
|
12284
12286
|
}
|
|
12287
|
+
renderWithOpacity(context) {
|
|
12288
|
+
if (this.opacity === 1) {
|
|
12289
|
+
this.render(context);
|
|
12290
|
+
return;
|
|
12291
|
+
}
|
|
12292
|
+
context.ctx.save();
|
|
12293
|
+
context.ctx.globalAlpha *= this.opacity;
|
|
12294
|
+
this.render(context);
|
|
12295
|
+
context.ctx.restore();
|
|
12296
|
+
}
|
|
12285
12297
|
getSnapAnchorPoints() {
|
|
12286
12298
|
return this.getMbr().getSnapAnchorPoints();
|
|
12287
12299
|
}
|
|
@@ -40701,7 +40713,9 @@ function registerHTMLRenderer(itemType, renderer) {
|
|
|
40701
40713
|
}
|
|
40702
40714
|
function renderItemToHTML(item, documentFactory) {
|
|
40703
40715
|
const renderer = renderers[item.itemType] || defaultRenderer;
|
|
40704
|
-
|
|
40716
|
+
const element2 = renderer.render(item, documentFactory);
|
|
40717
|
+
element2.style.opacity = `${item.opacity}`;
|
|
40718
|
+
return element2;
|
|
40705
40719
|
}
|
|
40706
40720
|
var defaultRenderer = {
|
|
40707
40721
|
render(item, documentFactory) {
|
|
@@ -42925,7 +42939,7 @@ class DrawingHTMLRenderer {
|
|
|
42925
42939
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
42926
42940
|
pathElement.setAttribute("d", this.getPathData(drawing));
|
|
42927
42941
|
pathElement.setAttribute("stroke", resolveColor(drawing.borderColor, conf.theme, drawing.colorRole));
|
|
42928
|
-
pathElement.setAttribute("stroke-opacity", `${drawing.
|
|
42942
|
+
pathElement.setAttribute("stroke-opacity", `${drawing.opacity}`);
|
|
42929
42943
|
pathElement.setAttribute("stroke-width", `${drawing.strokeWidth}`);
|
|
42930
42944
|
pathElement.setAttribute("fill", "none");
|
|
42931
42945
|
svg.appendChild(pathElement);
|
|
@@ -43988,7 +44002,7 @@ class SimpleSpatialIndex {
|
|
|
43988
44002
|
}
|
|
43989
44003
|
render(context) {
|
|
43990
44004
|
this.itemsArray.forEach((item) => {
|
|
43991
|
-
item.render(context);
|
|
44005
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
43992
44006
|
});
|
|
43993
44007
|
}
|
|
43994
44008
|
}
|
|
@@ -60305,7 +60319,7 @@ async function exportBoardScreenshot({
|
|
|
60305
60319
|
const { left, top, right, bottom } = selection;
|
|
60306
60320
|
const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
60307
60321
|
for (const item of inView) {
|
|
60308
|
-
item.render(context);
|
|
60322
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
60309
60323
|
}
|
|
60310
60324
|
const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
|
|
60311
60325
|
const dataUrl = await convertBlobToDataUrl(blob);
|
|
@@ -62760,6 +62774,7 @@ var DrawingDataSchema = exports_external.object({
|
|
|
62760
62774
|
strokeStyle: ColorValueSchema,
|
|
62761
62775
|
strokeWidth: exports_external.number(),
|
|
62762
62776
|
colorRole: exports_external.enum(["foreground", "background"]).optional(),
|
|
62777
|
+
opacity: exports_external.number().optional(),
|
|
62763
62778
|
linkTo: exports_external.string().optional()
|
|
62764
62779
|
});
|
|
62765
62780
|
|
|
@@ -62776,7 +62791,6 @@ class Drawing extends BaseItem {
|
|
|
62776
62791
|
borderStyle = "solid";
|
|
62777
62792
|
colorRole = "foreground";
|
|
62778
62793
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
62779
|
-
borderOpacity = 1;
|
|
62780
62794
|
transformationRenderBlock = undefined;
|
|
62781
62795
|
points = [];
|
|
62782
62796
|
constructor(board, id = "") {
|
|
@@ -62790,14 +62804,12 @@ class Drawing extends BaseItem {
|
|
|
62790
62804
|
points.push({ x: point5.x, y: point5.y });
|
|
62791
62805
|
}
|
|
62792
62806
|
return {
|
|
62793
|
-
|
|
62807
|
+
...super.serialize(),
|
|
62794
62808
|
itemType: "Drawing",
|
|
62795
62809
|
points,
|
|
62796
|
-
transformation: this.transformation.serialize(),
|
|
62797
62810
|
strokeStyle: this.borderColor,
|
|
62798
62811
|
strokeWidth: this.strokeWidth,
|
|
62799
|
-
colorRole: this.colorRole
|
|
62800
|
-
linkTo: this.linkTo.serialize()
|
|
62812
|
+
colorRole: this.colorRole
|
|
62801
62813
|
};
|
|
62802
62814
|
}
|
|
62803
62815
|
deserialize(data) {
|
|
@@ -62815,6 +62827,7 @@ class Drawing extends BaseItem {
|
|
|
62815
62827
|
if (data.colorRole) {
|
|
62816
62828
|
this.colorRole = data.colorRole;
|
|
62817
62829
|
}
|
|
62830
|
+
this.opacity = data.opacity ?? this.opacity;
|
|
62818
62831
|
this.updateVisuals({ method: "deserialize", class: this.itemType }, "FullRebuild" /* FullRebuild */);
|
|
62819
62832
|
return this;
|
|
62820
62833
|
}
|
|
@@ -62929,7 +62942,6 @@ class Drawing extends BaseItem {
|
|
|
62929
62942
|
const ctx = context.ctx;
|
|
62930
62943
|
ctx.save();
|
|
62931
62944
|
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
|
|
62932
|
-
ctx.globalAlpha = this.borderOpacity;
|
|
62933
62945
|
ctx.lineWidth = this.strokeWidth;
|
|
62934
62946
|
ctx.lineCap = "round";
|
|
62935
62947
|
ctx.setLineDash(this.linePattern);
|
|
@@ -63059,7 +63071,7 @@ class Drawing extends BaseItem {
|
|
|
63059
63071
|
"borderColor",
|
|
63060
63072
|
"strokeWidth",
|
|
63061
63073
|
"borderStyle",
|
|
63062
|
-
"
|
|
63074
|
+
"opacity",
|
|
63063
63075
|
"colorRole",
|
|
63064
63076
|
"strokeStyle"
|
|
63065
63077
|
];
|
|
@@ -63069,7 +63081,7 @@ class Drawing extends BaseItem {
|
|
|
63069
63081
|
return super.getPropertyUpdateHint(property);
|
|
63070
63082
|
}
|
|
63071
63083
|
getStrokeOpacity() {
|
|
63072
|
-
return this.
|
|
63084
|
+
return this.opacity;
|
|
63073
63085
|
}
|
|
63074
63086
|
getBorderStyle() {
|
|
63075
63087
|
return this.borderStyle;
|
|
@@ -63115,7 +63127,7 @@ registerItem({
|
|
|
63115
63127
|
itemType: "Drawing",
|
|
63116
63128
|
points: [],
|
|
63117
63129
|
borderColor: coerceColorValue("#000000"),
|
|
63118
|
-
|
|
63130
|
+
opacity: 1,
|
|
63119
63131
|
borderStyle: "solid",
|
|
63120
63132
|
strokeWidth: 2,
|
|
63121
63133
|
transformation: new DefaultTransformationData
|
|
@@ -64137,7 +64149,7 @@ class ShapeTool extends CustomTool {
|
|
|
64137
64149
|
}
|
|
64138
64150
|
render(context) {
|
|
64139
64151
|
if (this.isDown) {
|
|
64140
|
-
this.item.
|
|
64152
|
+
this.item.renderWithOpacity(context);
|
|
64141
64153
|
this.bounds.render(context);
|
|
64142
64154
|
}
|
|
64143
64155
|
}
|
|
@@ -68623,13 +68635,13 @@ function createCanvasDrawer(board) {
|
|
|
68623
68635
|
if (container2) {
|
|
68624
68636
|
context.ctx.save();
|
|
68625
68637
|
container2.getNestingMatrix().applyToContext(context.ctx);
|
|
68626
|
-
item.
|
|
68638
|
+
item.renderWithOpacity(context);
|
|
68627
68639
|
context.ctx.restore();
|
|
68628
68640
|
} else {
|
|
68629
|
-
item.
|
|
68641
|
+
item.renderWithOpacity(context);
|
|
68630
68642
|
}
|
|
68631
68643
|
} else {
|
|
68632
|
-
item.
|
|
68644
|
+
item.renderWithOpacity(context);
|
|
68633
68645
|
}
|
|
68634
68646
|
board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
|
|
68635
68647
|
}
|
|
@@ -73097,7 +73109,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
73097
73109
|
}
|
|
73098
73110
|
applyDrawingRole(drawing) {
|
|
73099
73111
|
drawing.setColorRole("background");
|
|
73100
|
-
drawing.apply(propertyOps.setProperty([drawing], "
|
|
73112
|
+
drawing.apply(propertyOps.setProperty([drawing], "opacity", 0.5));
|
|
73101
73113
|
}
|
|
73102
73114
|
updateSettings() {
|
|
73103
73115
|
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
package/dist/esm/index.js
CHANGED
|
@@ -11712,6 +11712,7 @@ class BaseItem {
|
|
|
11712
11712
|
shouldUseRelativeAlignment = true;
|
|
11713
11713
|
resizeEnabled = true;
|
|
11714
11714
|
onlyProportionalResize = false;
|
|
11715
|
+
opacity = 1;
|
|
11715
11716
|
itemType = "";
|
|
11716
11717
|
childIds = [];
|
|
11717
11718
|
isHoverHighlighted = false;
|
|
@@ -12064,6 +12065,7 @@ class BaseItem {
|
|
|
12064
12065
|
itemType: this.itemType,
|
|
12065
12066
|
childIds: this.childIds,
|
|
12066
12067
|
parent: this.parent,
|
|
12068
|
+
opacity: this.opacity,
|
|
12067
12069
|
resizeEnabled: this.resizeEnabled
|
|
12068
12070
|
};
|
|
12069
12071
|
}
|
|
@@ -12275,6 +12277,16 @@ class BaseItem {
|
|
|
12275
12277
|
this.index.render(context);
|
|
12276
12278
|
}
|
|
12277
12279
|
}
|
|
12280
|
+
renderWithOpacity(context) {
|
|
12281
|
+
if (this.opacity === 1) {
|
|
12282
|
+
this.render(context);
|
|
12283
|
+
return;
|
|
12284
|
+
}
|
|
12285
|
+
context.ctx.save();
|
|
12286
|
+
context.ctx.globalAlpha *= this.opacity;
|
|
12287
|
+
this.render(context);
|
|
12288
|
+
context.ctx.restore();
|
|
12289
|
+
}
|
|
12278
12290
|
getSnapAnchorPoints() {
|
|
12279
12291
|
return this.getMbr().getSnapAnchorPoints();
|
|
12280
12292
|
}
|
|
@@ -40694,7 +40706,9 @@ function registerHTMLRenderer(itemType, renderer) {
|
|
|
40694
40706
|
}
|
|
40695
40707
|
function renderItemToHTML(item, documentFactory) {
|
|
40696
40708
|
const renderer = renderers[item.itemType] || defaultRenderer;
|
|
40697
|
-
|
|
40709
|
+
const element2 = renderer.render(item, documentFactory);
|
|
40710
|
+
element2.style.opacity = `${item.opacity}`;
|
|
40711
|
+
return element2;
|
|
40698
40712
|
}
|
|
40699
40713
|
var defaultRenderer = {
|
|
40700
40714
|
render(item, documentFactory) {
|
|
@@ -42918,7 +42932,7 @@ class DrawingHTMLRenderer {
|
|
|
42918
42932
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
42919
42933
|
pathElement.setAttribute("d", this.getPathData(drawing));
|
|
42920
42934
|
pathElement.setAttribute("stroke", resolveColor(drawing.borderColor, conf.theme, drawing.colorRole));
|
|
42921
|
-
pathElement.setAttribute("stroke-opacity", `${drawing.
|
|
42935
|
+
pathElement.setAttribute("stroke-opacity", `${drawing.opacity}`);
|
|
42922
42936
|
pathElement.setAttribute("stroke-width", `${drawing.strokeWidth}`);
|
|
42923
42937
|
pathElement.setAttribute("fill", "none");
|
|
42924
42938
|
svg.appendChild(pathElement);
|
|
@@ -43981,7 +43995,7 @@ class SimpleSpatialIndex {
|
|
|
43981
43995
|
}
|
|
43982
43996
|
render(context) {
|
|
43983
43997
|
this.itemsArray.forEach((item) => {
|
|
43984
|
-
item.render(context);
|
|
43998
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
43985
43999
|
});
|
|
43986
44000
|
}
|
|
43987
44001
|
}
|
|
@@ -60298,7 +60312,7 @@ async function exportBoardScreenshot({
|
|
|
60298
60312
|
const { left, top, right, bottom } = selection;
|
|
60299
60313
|
const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
60300
60314
|
for (const item of inView) {
|
|
60301
|
-
item.render(context);
|
|
60315
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
60302
60316
|
}
|
|
60303
60317
|
const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
|
|
60304
60318
|
const dataUrl = await convertBlobToDataUrl(blob);
|
|
@@ -62753,6 +62767,7 @@ var DrawingDataSchema = exports_external.object({
|
|
|
62753
62767
|
strokeStyle: ColorValueSchema,
|
|
62754
62768
|
strokeWidth: exports_external.number(),
|
|
62755
62769
|
colorRole: exports_external.enum(["foreground", "background"]).optional(),
|
|
62770
|
+
opacity: exports_external.number().optional(),
|
|
62756
62771
|
linkTo: exports_external.string().optional()
|
|
62757
62772
|
});
|
|
62758
62773
|
|
|
@@ -62769,7 +62784,6 @@ class Drawing extends BaseItem {
|
|
|
62769
62784
|
borderStyle = "solid";
|
|
62770
62785
|
colorRole = "foreground";
|
|
62771
62786
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
62772
|
-
borderOpacity = 1;
|
|
62773
62787
|
transformationRenderBlock = undefined;
|
|
62774
62788
|
points = [];
|
|
62775
62789
|
constructor(board, id = "") {
|
|
@@ -62783,14 +62797,12 @@ class Drawing extends BaseItem {
|
|
|
62783
62797
|
points.push({ x: point5.x, y: point5.y });
|
|
62784
62798
|
}
|
|
62785
62799
|
return {
|
|
62786
|
-
|
|
62800
|
+
...super.serialize(),
|
|
62787
62801
|
itemType: "Drawing",
|
|
62788
62802
|
points,
|
|
62789
|
-
transformation: this.transformation.serialize(),
|
|
62790
62803
|
strokeStyle: this.borderColor,
|
|
62791
62804
|
strokeWidth: this.strokeWidth,
|
|
62792
|
-
colorRole: this.colorRole
|
|
62793
|
-
linkTo: this.linkTo.serialize()
|
|
62805
|
+
colorRole: this.colorRole
|
|
62794
62806
|
};
|
|
62795
62807
|
}
|
|
62796
62808
|
deserialize(data) {
|
|
@@ -62808,6 +62820,7 @@ class Drawing extends BaseItem {
|
|
|
62808
62820
|
if (data.colorRole) {
|
|
62809
62821
|
this.colorRole = data.colorRole;
|
|
62810
62822
|
}
|
|
62823
|
+
this.opacity = data.opacity ?? this.opacity;
|
|
62811
62824
|
this.updateVisuals({ method: "deserialize", class: this.itemType }, "FullRebuild" /* FullRebuild */);
|
|
62812
62825
|
return this;
|
|
62813
62826
|
}
|
|
@@ -62922,7 +62935,6 @@ class Drawing extends BaseItem {
|
|
|
62922
62935
|
const ctx = context.ctx;
|
|
62923
62936
|
ctx.save();
|
|
62924
62937
|
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
|
|
62925
|
-
ctx.globalAlpha = this.borderOpacity;
|
|
62926
62938
|
ctx.lineWidth = this.strokeWidth;
|
|
62927
62939
|
ctx.lineCap = "round";
|
|
62928
62940
|
ctx.setLineDash(this.linePattern);
|
|
@@ -63052,7 +63064,7 @@ class Drawing extends BaseItem {
|
|
|
63052
63064
|
"borderColor",
|
|
63053
63065
|
"strokeWidth",
|
|
63054
63066
|
"borderStyle",
|
|
63055
|
-
"
|
|
63067
|
+
"opacity",
|
|
63056
63068
|
"colorRole",
|
|
63057
63069
|
"strokeStyle"
|
|
63058
63070
|
];
|
|
@@ -63062,7 +63074,7 @@ class Drawing extends BaseItem {
|
|
|
63062
63074
|
return super.getPropertyUpdateHint(property);
|
|
63063
63075
|
}
|
|
63064
63076
|
getStrokeOpacity() {
|
|
63065
|
-
return this.
|
|
63077
|
+
return this.opacity;
|
|
63066
63078
|
}
|
|
63067
63079
|
getBorderStyle() {
|
|
63068
63080
|
return this.borderStyle;
|
|
@@ -63108,7 +63120,7 @@ registerItem({
|
|
|
63108
63120
|
itemType: "Drawing",
|
|
63109
63121
|
points: [],
|
|
63110
63122
|
borderColor: coerceColorValue("#000000"),
|
|
63111
|
-
|
|
63123
|
+
opacity: 1,
|
|
63112
63124
|
borderStyle: "solid",
|
|
63113
63125
|
strokeWidth: 2,
|
|
63114
63126
|
transformation: new DefaultTransformationData
|
|
@@ -64130,7 +64142,7 @@ class ShapeTool extends CustomTool {
|
|
|
64130
64142
|
}
|
|
64131
64143
|
render(context) {
|
|
64132
64144
|
if (this.isDown) {
|
|
64133
|
-
this.item.
|
|
64145
|
+
this.item.renderWithOpacity(context);
|
|
64134
64146
|
this.bounds.render(context);
|
|
64135
64147
|
}
|
|
64136
64148
|
}
|
|
@@ -68616,13 +68628,13 @@ function createCanvasDrawer(board) {
|
|
|
68616
68628
|
if (container2) {
|
|
68617
68629
|
context.ctx.save();
|
|
68618
68630
|
container2.getNestingMatrix().applyToContext(context.ctx);
|
|
68619
|
-
item.
|
|
68631
|
+
item.renderWithOpacity(context);
|
|
68620
68632
|
context.ctx.restore();
|
|
68621
68633
|
} else {
|
|
68622
|
-
item.
|
|
68634
|
+
item.renderWithOpacity(context);
|
|
68623
68635
|
}
|
|
68624
68636
|
} else {
|
|
68625
|
-
item.
|
|
68637
|
+
item.renderWithOpacity(context);
|
|
68626
68638
|
}
|
|
68627
68639
|
board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
|
|
68628
68640
|
}
|
|
@@ -73090,7 +73102,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
73090
73102
|
}
|
|
73091
73103
|
applyDrawingRole(drawing) {
|
|
73092
73104
|
drawing.setColorRole("background");
|
|
73093
|
-
drawing.apply(propertyOps.setProperty([drawing], "
|
|
73105
|
+
drawing.apply(propertyOps.setProperty([drawing], "opacity", 0.5));
|
|
73094
73106
|
}
|
|
73095
73107
|
updateSettings() {
|
|
73096
73108
|
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
package/dist/esm/node.js
CHANGED
|
@@ -12495,6 +12495,7 @@ class BaseItem {
|
|
|
12495
12495
|
shouldUseRelativeAlignment = true;
|
|
12496
12496
|
resizeEnabled = true;
|
|
12497
12497
|
onlyProportionalResize = false;
|
|
12498
|
+
opacity = 1;
|
|
12498
12499
|
itemType = "";
|
|
12499
12500
|
childIds = [];
|
|
12500
12501
|
isHoverHighlighted = false;
|
|
@@ -12847,6 +12848,7 @@ class BaseItem {
|
|
|
12847
12848
|
itemType: this.itemType,
|
|
12848
12849
|
childIds: this.childIds,
|
|
12849
12850
|
parent: this.parent,
|
|
12851
|
+
opacity: this.opacity,
|
|
12850
12852
|
resizeEnabled: this.resizeEnabled
|
|
12851
12853
|
};
|
|
12852
12854
|
}
|
|
@@ -13058,6 +13060,16 @@ class BaseItem {
|
|
|
13058
13060
|
this.index.render(context);
|
|
13059
13061
|
}
|
|
13060
13062
|
}
|
|
13063
|
+
renderWithOpacity(context) {
|
|
13064
|
+
if (this.opacity === 1) {
|
|
13065
|
+
this.render(context);
|
|
13066
|
+
return;
|
|
13067
|
+
}
|
|
13068
|
+
context.ctx.save();
|
|
13069
|
+
context.ctx.globalAlpha *= this.opacity;
|
|
13070
|
+
this.render(context);
|
|
13071
|
+
context.ctx.restore();
|
|
13072
|
+
}
|
|
13061
13073
|
getSnapAnchorPoints() {
|
|
13062
13074
|
return this.getMbr().getSnapAnchorPoints();
|
|
13063
13075
|
}
|
|
@@ -43161,7 +43173,9 @@ function registerHTMLRenderer(itemType, renderer) {
|
|
|
43161
43173
|
}
|
|
43162
43174
|
function renderItemToHTML(item, documentFactory) {
|
|
43163
43175
|
const renderer = renderers[item.itemType] || defaultRenderer;
|
|
43164
|
-
|
|
43176
|
+
const element = renderer.render(item, documentFactory);
|
|
43177
|
+
element.style.opacity = `${item.opacity}`;
|
|
43178
|
+
return element;
|
|
43165
43179
|
}
|
|
43166
43180
|
var defaultRenderer = {
|
|
43167
43181
|
render(item, documentFactory) {
|
|
@@ -45385,7 +45399,7 @@ class DrawingHTMLRenderer {
|
|
|
45385
45399
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
45386
45400
|
pathElement.setAttribute("d", this.getPathData(drawing));
|
|
45387
45401
|
pathElement.setAttribute("stroke", resolveColor(drawing.borderColor, conf.theme, drawing.colorRole));
|
|
45388
|
-
pathElement.setAttribute("stroke-opacity", `${drawing.
|
|
45402
|
+
pathElement.setAttribute("stroke-opacity", `${drawing.opacity}`);
|
|
45389
45403
|
pathElement.setAttribute("stroke-width", `${drawing.strokeWidth}`);
|
|
45390
45404
|
pathElement.setAttribute("fill", "none");
|
|
45391
45405
|
svg.appendChild(pathElement);
|
|
@@ -46448,7 +46462,7 @@ class SimpleSpatialIndex {
|
|
|
46448
46462
|
}
|
|
46449
46463
|
render(context) {
|
|
46450
46464
|
this.itemsArray.forEach((item) => {
|
|
46451
|
-
item.render(context);
|
|
46465
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
46452
46466
|
});
|
|
46453
46467
|
}
|
|
46454
46468
|
}
|
|
@@ -62766,7 +62780,7 @@ async function exportBoardScreenshot({
|
|
|
62766
62780
|
const { left, top, right, bottom } = selection;
|
|
62767
62781
|
const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
|
|
62768
62782
|
for (const item of inView) {
|
|
62769
|
-
item.render(context);
|
|
62783
|
+
item.renderWithOpacity?.(context) ?? item.render(context);
|
|
62770
62784
|
}
|
|
62771
62785
|
const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
|
|
62772
62786
|
const dataUrl = await convertBlobToDataUrl(blob);
|
|
@@ -65221,6 +65235,7 @@ var DrawingDataSchema = exports_external.object({
|
|
|
65221
65235
|
strokeStyle: ColorValueSchema,
|
|
65222
65236
|
strokeWidth: exports_external.number(),
|
|
65223
65237
|
colorRole: exports_external.enum(["foreground", "background"]).optional(),
|
|
65238
|
+
opacity: exports_external.number().optional(),
|
|
65224
65239
|
linkTo: exports_external.string().optional()
|
|
65225
65240
|
});
|
|
65226
65241
|
|
|
@@ -65237,7 +65252,6 @@ class Drawing extends BaseItem {
|
|
|
65237
65252
|
borderStyle = "solid";
|
|
65238
65253
|
colorRole = "foreground";
|
|
65239
65254
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
65240
|
-
borderOpacity = 1;
|
|
65241
65255
|
transformationRenderBlock = undefined;
|
|
65242
65256
|
points = [];
|
|
65243
65257
|
constructor(board, id = "") {
|
|
@@ -65251,14 +65265,12 @@ class Drawing extends BaseItem {
|
|
|
65251
65265
|
points.push({ x: point5.x, y: point5.y });
|
|
65252
65266
|
}
|
|
65253
65267
|
return {
|
|
65254
|
-
|
|
65268
|
+
...super.serialize(),
|
|
65255
65269
|
itemType: "Drawing",
|
|
65256
65270
|
points,
|
|
65257
|
-
transformation: this.transformation.serialize(),
|
|
65258
65271
|
strokeStyle: this.borderColor,
|
|
65259
65272
|
strokeWidth: this.strokeWidth,
|
|
65260
|
-
colorRole: this.colorRole
|
|
65261
|
-
linkTo: this.linkTo.serialize()
|
|
65273
|
+
colorRole: this.colorRole
|
|
65262
65274
|
};
|
|
65263
65275
|
}
|
|
65264
65276
|
deserialize(data) {
|
|
@@ -65276,6 +65288,7 @@ class Drawing extends BaseItem {
|
|
|
65276
65288
|
if (data.colorRole) {
|
|
65277
65289
|
this.colorRole = data.colorRole;
|
|
65278
65290
|
}
|
|
65291
|
+
this.opacity = data.opacity ?? this.opacity;
|
|
65279
65292
|
this.updateVisuals({ method: "deserialize", class: this.itemType }, "FullRebuild" /* FullRebuild */);
|
|
65280
65293
|
return this;
|
|
65281
65294
|
}
|
|
@@ -65390,7 +65403,6 @@ class Drawing extends BaseItem {
|
|
|
65390
65403
|
const ctx = context.ctx;
|
|
65391
65404
|
ctx.save();
|
|
65392
65405
|
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
|
|
65393
|
-
ctx.globalAlpha = this.borderOpacity;
|
|
65394
65406
|
ctx.lineWidth = this.strokeWidth;
|
|
65395
65407
|
ctx.lineCap = "round";
|
|
65396
65408
|
ctx.setLineDash(this.linePattern);
|
|
@@ -65520,7 +65532,7 @@ class Drawing extends BaseItem {
|
|
|
65520
65532
|
"borderColor",
|
|
65521
65533
|
"strokeWidth",
|
|
65522
65534
|
"borderStyle",
|
|
65523
|
-
"
|
|
65535
|
+
"opacity",
|
|
65524
65536
|
"colorRole",
|
|
65525
65537
|
"strokeStyle"
|
|
65526
65538
|
];
|
|
@@ -65530,7 +65542,7 @@ class Drawing extends BaseItem {
|
|
|
65530
65542
|
return super.getPropertyUpdateHint(property);
|
|
65531
65543
|
}
|
|
65532
65544
|
getStrokeOpacity() {
|
|
65533
|
-
return this.
|
|
65545
|
+
return this.opacity;
|
|
65534
65546
|
}
|
|
65535
65547
|
getBorderStyle() {
|
|
65536
65548
|
return this.borderStyle;
|
|
@@ -65576,7 +65588,7 @@ registerItem({
|
|
|
65576
65588
|
itemType: "Drawing",
|
|
65577
65589
|
points: [],
|
|
65578
65590
|
borderColor: coerceColorValue("#000000"),
|
|
65579
|
-
|
|
65591
|
+
opacity: 1,
|
|
65580
65592
|
borderStyle: "solid",
|
|
65581
65593
|
strokeWidth: 2,
|
|
65582
65594
|
transformation: new DefaultTransformationData
|
|
@@ -66598,7 +66610,7 @@ class ShapeTool extends CustomTool {
|
|
|
66598
66610
|
}
|
|
66599
66611
|
render(context) {
|
|
66600
66612
|
if (this.isDown) {
|
|
66601
|
-
this.item.
|
|
66613
|
+
this.item.renderWithOpacity(context);
|
|
66602
66614
|
this.bounds.render(context);
|
|
66603
66615
|
}
|
|
66604
66616
|
}
|
|
@@ -71084,13 +71096,13 @@ function createCanvasDrawer(board) {
|
|
|
71084
71096
|
if (container2) {
|
|
71085
71097
|
context.ctx.save();
|
|
71086
71098
|
container2.getNestingMatrix().applyToContext(context.ctx);
|
|
71087
|
-
item.
|
|
71099
|
+
item.renderWithOpacity(context);
|
|
71088
71100
|
context.ctx.restore();
|
|
71089
71101
|
} else {
|
|
71090
|
-
item.
|
|
71102
|
+
item.renderWithOpacity(context);
|
|
71091
71103
|
}
|
|
71092
71104
|
} else {
|
|
71093
|
-
item.
|
|
71105
|
+
item.renderWithOpacity(context);
|
|
71094
71106
|
}
|
|
71095
71107
|
board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
|
|
71096
71108
|
}
|
|
@@ -75558,7 +75570,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
75558
75570
|
}
|
|
75559
75571
|
applyDrawingRole(drawing) {
|
|
75560
75572
|
drawing.setColorRole("background");
|
|
75561
|
-
drawing.apply(propertyOps.setProperty([drawing], "
|
|
75573
|
+
drawing.apply(propertyOps.setProperty([drawing], "opacity", 0.5));
|
|
75562
75574
|
}
|
|
75563
75575
|
updateSettings() {
|
|
75564
75576
|
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
@@ -29,6 +29,7 @@ export interface BaseItemData {
|
|
|
29
29
|
linkTo?: string;
|
|
30
30
|
childIds?: string[];
|
|
31
31
|
parent?: string;
|
|
32
|
+
opacity?: number;
|
|
32
33
|
[key: string]: unknown;
|
|
33
34
|
}
|
|
34
35
|
export type SerializedItemData<T extends BaseItemData = BaseItemData> = T & {
|
|
@@ -53,6 +54,7 @@ export declare class BaseItem<T extends BaseItem<any> = any> implements Geometry
|
|
|
53
54
|
shouldUseRelativeAlignment: boolean;
|
|
54
55
|
resizeEnabled: boolean;
|
|
55
56
|
onlyProportionalResize: boolean;
|
|
57
|
+
opacity: number;
|
|
56
58
|
itemType: ItemType;
|
|
57
59
|
childIds: string[];
|
|
58
60
|
isHoverHighlighted: boolean;
|
|
@@ -156,6 +158,7 @@ export declare class BaseItem<T extends BaseItem<any> = any> implements Geometry
|
|
|
156
158
|
clearHighlightMbr(): void;
|
|
157
159
|
renderHoverHighlight(context: DrawingContext): void;
|
|
158
160
|
render(context: DrawingContext): void;
|
|
161
|
+
renderWithOpacity(context: DrawingContext): void;
|
|
159
162
|
getSnapAnchorPoints(): Point[];
|
|
160
163
|
getPointOnEdge(point: Point, _edge?: string): Point;
|
|
161
164
|
handleTransform(params: TransformParams): TransformResult;
|
|
@@ -23,6 +23,7 @@ export interface DrawingData {
|
|
|
23
23
|
strokeStyle: ColorValue | string;
|
|
24
24
|
strokeWidth: number;
|
|
25
25
|
colorRole?: ColorRole;
|
|
26
|
+
opacity?: number;
|
|
26
27
|
linkTo?: string;
|
|
27
28
|
[key: string]: unknown;
|
|
28
29
|
}
|
|
@@ -38,7 +39,6 @@ export declare class Drawing extends BaseItem<Drawing> {
|
|
|
38
39
|
borderStyle: BorderStyle;
|
|
39
40
|
colorRole: ColorRole;
|
|
40
41
|
private linePattern;
|
|
41
|
-
private borderOpacity;
|
|
42
42
|
transformationRenderBlock?: boolean;
|
|
43
43
|
points: Point[];
|
|
44
44
|
constructor(board: Board, id?: string);
|
|
@@ -37,6 +37,7 @@ export declare const DrawingDataSchema: z.ZodObject<{
|
|
|
37
37
|
background: "background";
|
|
38
38
|
foreground: "foreground";
|
|
39
39
|
}>>;
|
|
40
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
40
41
|
linkTo: z.ZodOptional<z.ZodString>;
|
|
41
42
|
}, z.core.$strip>;
|
|
42
43
|
export type DrawingData = z.infer<typeof DrawingDataSchema>;
|