microboard-temp 0.14.27 → 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.
@@ -12510,6 +12510,16 @@ class BaseItem {
12510
12510
  this.index.render(context);
12511
12511
  }
12512
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
+ }
12513
12523
  getSnapAnchorPoints() {
12514
12524
  return this.getMbr().getSnapAnchorPoints();
12515
12525
  }
@@ -40921,7 +40931,9 @@ function registerHTMLRenderer(itemType, renderer) {
40921
40931
  }
40922
40932
  function renderItemToHTML(item, documentFactory) {
40923
40933
  const renderer = renderers[item.itemType] || defaultRenderer;
40924
- return renderer.render(item, documentFactory);
40934
+ const element2 = renderer.render(item, documentFactory);
40935
+ element2.style.opacity = `${item.opacity}`;
40936
+ return element2;
40925
40937
  }
40926
40938
  var defaultRenderer = {
40927
40939
  render(item, documentFactory) {
@@ -44208,7 +44220,7 @@ class SimpleSpatialIndex {
44208
44220
  }
44209
44221
  render(context) {
44210
44222
  this.itemsArray.forEach((item) => {
44211
- item.render(context);
44223
+ item.renderWithOpacity?.(context) ?? item.render(context);
44212
44224
  });
44213
44225
  }
44214
44226
  }
@@ -60525,7 +60537,7 @@ async function exportBoardScreenshot({
60525
60537
  const { left, top, right, bottom } = selection;
60526
60538
  const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
60527
60539
  for (const item of inView) {
60528
- item.render(context);
60540
+ item.renderWithOpacity?.(context) ?? item.render(context);
60529
60541
  }
60530
60542
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
60531
60543
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -63148,7 +63160,6 @@ class Drawing extends BaseItem {
63148
63160
  const ctx = context.ctx;
63149
63161
  ctx.save();
63150
63162
  ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
63151
- ctx.globalAlpha = this.opacity;
63152
63163
  ctx.lineWidth = this.strokeWidth;
63153
63164
  ctx.lineCap = "round";
63154
63165
  ctx.setLineDash(this.linePattern);
@@ -64356,7 +64367,7 @@ class ShapeTool extends CustomTool {
64356
64367
  }
64357
64368
  render(context) {
64358
64369
  if (this.isDown) {
64359
- this.item.render(context);
64370
+ this.item.renderWithOpacity(context);
64360
64371
  this.bounds.render(context);
64361
64372
  }
64362
64373
  }
@@ -68842,13 +68853,13 @@ function createCanvasDrawer(board) {
68842
68853
  if (container2) {
68843
68854
  context.ctx.save();
68844
68855
  container2.getNestingMatrix().applyToContext(context.ctx);
68845
- item.render(context);
68856
+ item.renderWithOpacity(context);
68846
68857
  context.ctx.restore();
68847
68858
  } else {
68848
- item.render(context);
68859
+ item.renderWithOpacity(context);
68849
68860
  }
68850
68861
  } else {
68851
- item.render(context);
68862
+ item.renderWithOpacity(context);
68852
68863
  }
68853
68864
  board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
68854
68865
  }
package/dist/cjs/index.js CHANGED
@@ -12510,6 +12510,16 @@ class BaseItem {
12510
12510
  this.index.render(context);
12511
12511
  }
12512
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
+ }
12513
12523
  getSnapAnchorPoints() {
12514
12524
  return this.getMbr().getSnapAnchorPoints();
12515
12525
  }
@@ -40921,7 +40931,9 @@ function registerHTMLRenderer(itemType, renderer) {
40921
40931
  }
40922
40932
  function renderItemToHTML(item, documentFactory) {
40923
40933
  const renderer = renderers[item.itemType] || defaultRenderer;
40924
- return renderer.render(item, documentFactory);
40934
+ const element2 = renderer.render(item, documentFactory);
40935
+ element2.style.opacity = `${item.opacity}`;
40936
+ return element2;
40925
40937
  }
40926
40938
  var defaultRenderer = {
40927
40939
  render(item, documentFactory) {
@@ -44208,7 +44220,7 @@ class SimpleSpatialIndex {
44208
44220
  }
44209
44221
  render(context) {
44210
44222
  this.itemsArray.forEach((item) => {
44211
- item.render(context);
44223
+ item.renderWithOpacity?.(context) ?? item.render(context);
44212
44224
  });
44213
44225
  }
44214
44226
  }
@@ -60525,7 +60537,7 @@ async function exportBoardScreenshot({
60525
60537
  const { left, top, right, bottom } = selection;
60526
60538
  const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
60527
60539
  for (const item of inView) {
60528
- item.render(context);
60540
+ item.renderWithOpacity?.(context) ?? item.render(context);
60529
60541
  }
60530
60542
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
60531
60543
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -63148,7 +63160,6 @@ class Drawing extends BaseItem {
63148
63160
  const ctx = context.ctx;
63149
63161
  ctx.save();
63150
63162
  ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
63151
- ctx.globalAlpha = this.opacity;
63152
63163
  ctx.lineWidth = this.strokeWidth;
63153
63164
  ctx.lineCap = "round";
63154
63165
  ctx.setLineDash(this.linePattern);
@@ -64356,7 +64367,7 @@ class ShapeTool extends CustomTool {
64356
64367
  }
64357
64368
  render(context) {
64358
64369
  if (this.isDown) {
64359
- this.item.render(context);
64370
+ this.item.renderWithOpacity(context);
64360
64371
  this.bounds.render(context);
64361
64372
  }
64362
64373
  }
@@ -68842,13 +68853,13 @@ function createCanvasDrawer(board) {
68842
68853
  if (container2) {
68843
68854
  context.ctx.save();
68844
68855
  container2.getNestingMatrix().applyToContext(context.ctx);
68845
- item.render(context);
68856
+ item.renderWithOpacity(context);
68846
68857
  context.ctx.restore();
68847
68858
  } else {
68848
- item.render(context);
68859
+ item.renderWithOpacity(context);
68849
68860
  }
68850
68861
  } else {
68851
- item.render(context);
68862
+ item.renderWithOpacity(context);
68852
68863
  }
68853
68864
  board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
68854
68865
  }
package/dist/cjs/node.js CHANGED
@@ -13546,6 +13546,16 @@ class BaseItem {
13546
13546
  this.index.render(context);
13547
13547
  }
13548
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
+ }
13549
13559
  getSnapAnchorPoints() {
13550
13560
  return this.getMbr().getSnapAnchorPoints();
13551
13561
  }
@@ -43393,7 +43403,9 @@ function registerHTMLRenderer(itemType, renderer) {
43393
43403
  }
43394
43404
  function renderItemToHTML(item, documentFactory) {
43395
43405
  const renderer = renderers[item.itemType] || defaultRenderer;
43396
- return renderer.render(item, documentFactory);
43406
+ const element = renderer.render(item, documentFactory);
43407
+ element.style.opacity = `${item.opacity}`;
43408
+ return element;
43397
43409
  }
43398
43410
  var defaultRenderer = {
43399
43411
  render(item, documentFactory) {
@@ -46680,7 +46692,7 @@ class SimpleSpatialIndex {
46680
46692
  }
46681
46693
  render(context) {
46682
46694
  this.itemsArray.forEach((item) => {
46683
- item.render(context);
46695
+ item.renderWithOpacity?.(context) ?? item.render(context);
46684
46696
  });
46685
46697
  }
46686
46698
  }
@@ -62998,7 +63010,7 @@ async function exportBoardScreenshot({
62998
63010
  const { left, top, right, bottom } = selection;
62999
63011
  const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
63000
63012
  for (const item of inView) {
63001
- item.render(context);
63013
+ item.renderWithOpacity?.(context) ?? item.render(context);
63002
63014
  }
63003
63015
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
63004
63016
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -65621,7 +65633,6 @@ class Drawing extends BaseItem {
65621
65633
  const ctx = context.ctx;
65622
65634
  ctx.save();
65623
65635
  ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
65624
- ctx.globalAlpha = this.opacity;
65625
65636
  ctx.lineWidth = this.strokeWidth;
65626
65637
  ctx.lineCap = "round";
65627
65638
  ctx.setLineDash(this.linePattern);
@@ -66829,7 +66840,7 @@ class ShapeTool extends CustomTool {
66829
66840
  }
66830
66841
  render(context) {
66831
66842
  if (this.isDown) {
66832
- this.item.render(context);
66843
+ this.item.renderWithOpacity(context);
66833
66844
  this.bounds.render(context);
66834
66845
  }
66835
66846
  }
@@ -71315,13 +71326,13 @@ function createCanvasDrawer(board) {
71315
71326
  if (container2) {
71316
71327
  context.ctx.save();
71317
71328
  container2.getNestingMatrix().applyToContext(context.ctx);
71318
- item.render(context);
71329
+ item.renderWithOpacity(context);
71319
71330
  context.ctx.restore();
71320
71331
  } else {
71321
- item.render(context);
71332
+ item.renderWithOpacity(context);
71322
71333
  }
71323
71334
  } else {
71324
- item.render(context);
71335
+ item.renderWithOpacity(context);
71325
71336
  }
71326
71337
  board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
71327
71338
  }
@@ -12284,6 +12284,16 @@ class BaseItem {
12284
12284
  this.index.render(context);
12285
12285
  }
12286
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
+ }
12287
12297
  getSnapAnchorPoints() {
12288
12298
  return this.getMbr().getSnapAnchorPoints();
12289
12299
  }
@@ -40703,7 +40713,9 @@ function registerHTMLRenderer(itemType, renderer) {
40703
40713
  }
40704
40714
  function renderItemToHTML(item, documentFactory) {
40705
40715
  const renderer = renderers[item.itemType] || defaultRenderer;
40706
- return renderer.render(item, documentFactory);
40716
+ const element2 = renderer.render(item, documentFactory);
40717
+ element2.style.opacity = `${item.opacity}`;
40718
+ return element2;
40707
40719
  }
40708
40720
  var defaultRenderer = {
40709
40721
  render(item, documentFactory) {
@@ -43990,7 +44002,7 @@ class SimpleSpatialIndex {
43990
44002
  }
43991
44003
  render(context) {
43992
44004
  this.itemsArray.forEach((item) => {
43993
- item.render(context);
44005
+ item.renderWithOpacity?.(context) ?? item.render(context);
43994
44006
  });
43995
44007
  }
43996
44008
  }
@@ -60307,7 +60319,7 @@ async function exportBoardScreenshot({
60307
60319
  const { left, top, right, bottom } = selection;
60308
60320
  const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
60309
60321
  for (const item of inView) {
60310
- item.render(context);
60322
+ item.renderWithOpacity?.(context) ?? item.render(context);
60311
60323
  }
60312
60324
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
60313
60325
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -62930,7 +62942,6 @@ class Drawing extends BaseItem {
62930
62942
  const ctx = context.ctx;
62931
62943
  ctx.save();
62932
62944
  ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
62933
- ctx.globalAlpha = this.opacity;
62934
62945
  ctx.lineWidth = this.strokeWidth;
62935
62946
  ctx.lineCap = "round";
62936
62947
  ctx.setLineDash(this.linePattern);
@@ -64138,7 +64149,7 @@ class ShapeTool extends CustomTool {
64138
64149
  }
64139
64150
  render(context) {
64140
64151
  if (this.isDown) {
64141
- this.item.render(context);
64152
+ this.item.renderWithOpacity(context);
64142
64153
  this.bounds.render(context);
64143
64154
  }
64144
64155
  }
@@ -68624,13 +68635,13 @@ function createCanvasDrawer(board) {
68624
68635
  if (container2) {
68625
68636
  context.ctx.save();
68626
68637
  container2.getNestingMatrix().applyToContext(context.ctx);
68627
- item.render(context);
68638
+ item.renderWithOpacity(context);
68628
68639
  context.ctx.restore();
68629
68640
  } else {
68630
- item.render(context);
68641
+ item.renderWithOpacity(context);
68631
68642
  }
68632
68643
  } else {
68633
- item.render(context);
68644
+ item.renderWithOpacity(context);
68634
68645
  }
68635
68646
  board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
68636
68647
  }
package/dist/esm/index.js CHANGED
@@ -12277,6 +12277,16 @@ class BaseItem {
12277
12277
  this.index.render(context);
12278
12278
  }
12279
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
+ }
12280
12290
  getSnapAnchorPoints() {
12281
12291
  return this.getMbr().getSnapAnchorPoints();
12282
12292
  }
@@ -40696,7 +40706,9 @@ function registerHTMLRenderer(itemType, renderer) {
40696
40706
  }
40697
40707
  function renderItemToHTML(item, documentFactory) {
40698
40708
  const renderer = renderers[item.itemType] || defaultRenderer;
40699
- return renderer.render(item, documentFactory);
40709
+ const element2 = renderer.render(item, documentFactory);
40710
+ element2.style.opacity = `${item.opacity}`;
40711
+ return element2;
40700
40712
  }
40701
40713
  var defaultRenderer = {
40702
40714
  render(item, documentFactory) {
@@ -43983,7 +43995,7 @@ class SimpleSpatialIndex {
43983
43995
  }
43984
43996
  render(context) {
43985
43997
  this.itemsArray.forEach((item) => {
43986
- item.render(context);
43998
+ item.renderWithOpacity?.(context) ?? item.render(context);
43987
43999
  });
43988
44000
  }
43989
44001
  }
@@ -60300,7 +60312,7 @@ async function exportBoardScreenshot({
60300
60312
  const { left, top, right, bottom } = selection;
60301
60313
  const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
60302
60314
  for (const item of inView) {
60303
- item.render(context);
60315
+ item.renderWithOpacity?.(context) ?? item.render(context);
60304
60316
  }
60305
60317
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
60306
60318
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -62923,7 +62935,6 @@ class Drawing extends BaseItem {
62923
62935
  const ctx = context.ctx;
62924
62936
  ctx.save();
62925
62937
  ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
62926
- ctx.globalAlpha = this.opacity;
62927
62938
  ctx.lineWidth = this.strokeWidth;
62928
62939
  ctx.lineCap = "round";
62929
62940
  ctx.setLineDash(this.linePattern);
@@ -64131,7 +64142,7 @@ class ShapeTool extends CustomTool {
64131
64142
  }
64132
64143
  render(context) {
64133
64144
  if (this.isDown) {
64134
- this.item.render(context);
64145
+ this.item.renderWithOpacity(context);
64135
64146
  this.bounds.render(context);
64136
64147
  }
64137
64148
  }
@@ -68617,13 +68628,13 @@ function createCanvasDrawer(board) {
68617
68628
  if (container2) {
68618
68629
  context.ctx.save();
68619
68630
  container2.getNestingMatrix().applyToContext(context.ctx);
68620
- item.render(context);
68631
+ item.renderWithOpacity(context);
68621
68632
  context.ctx.restore();
68622
68633
  } else {
68623
- item.render(context);
68634
+ item.renderWithOpacity(context);
68624
68635
  }
68625
68636
  } else {
68626
- item.render(context);
68637
+ item.renderWithOpacity(context);
68627
68638
  }
68628
68639
  board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
68629
68640
  }
package/dist/esm/node.js CHANGED
@@ -13060,6 +13060,16 @@ class BaseItem {
13060
13060
  this.index.render(context);
13061
13061
  }
13062
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
+ }
13063
13073
  getSnapAnchorPoints() {
13064
13074
  return this.getMbr().getSnapAnchorPoints();
13065
13075
  }
@@ -43163,7 +43173,9 @@ function registerHTMLRenderer(itemType, renderer) {
43163
43173
  }
43164
43174
  function renderItemToHTML(item, documentFactory) {
43165
43175
  const renderer = renderers[item.itemType] || defaultRenderer;
43166
- return renderer.render(item, documentFactory);
43176
+ const element = renderer.render(item, documentFactory);
43177
+ element.style.opacity = `${item.opacity}`;
43178
+ return element;
43167
43179
  }
43168
43180
  var defaultRenderer = {
43169
43181
  render(item, documentFactory) {
@@ -46450,7 +46462,7 @@ class SimpleSpatialIndex {
46450
46462
  }
46451
46463
  render(context) {
46452
46464
  this.itemsArray.forEach((item) => {
46453
- item.render(context);
46465
+ item.renderWithOpacity?.(context) ?? item.render(context);
46454
46466
  });
46455
46467
  }
46456
46468
  }
@@ -62768,7 +62780,7 @@ async function exportBoardScreenshot({
62768
62780
  const { left, top, right, bottom } = selection;
62769
62781
  const inView = board.items.index.listEnclosedOrCrossedBy(left, top, right, bottom);
62770
62782
  for (const item of inView) {
62771
- item.render(context);
62783
+ item.renderWithOpacity?.(context) ?? item.render(context);
62772
62784
  }
62773
62785
  const blob = await offscreenCanvas.convertToBlob({ type: "image/png" });
62774
62786
  const dataUrl = await convertBlobToDataUrl(blob);
@@ -65391,7 +65403,6 @@ class Drawing extends BaseItem {
65391
65403
  const ctx = context.ctx;
65392
65404
  ctx.save();
65393
65405
  ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, this.colorRole);
65394
- ctx.globalAlpha = this.opacity;
65395
65406
  ctx.lineWidth = this.strokeWidth;
65396
65407
  ctx.lineCap = "round";
65397
65408
  ctx.setLineDash(this.linePattern);
@@ -66599,7 +66610,7 @@ class ShapeTool extends CustomTool {
66599
66610
  }
66600
66611
  render(context) {
66601
66612
  if (this.isDown) {
66602
- this.item.render(context);
66613
+ this.item.renderWithOpacity(context);
66603
66614
  this.bounds.render(context);
66604
66615
  }
66605
66616
  }
@@ -71085,13 +71096,13 @@ function createCanvasDrawer(board) {
71085
71096
  if (container2) {
71086
71097
  context.ctx.save();
71087
71098
  container2.getNestingMatrix().applyToContext(context.ctx);
71088
- item.render(context);
71099
+ item.renderWithOpacity(context);
71089
71100
  context.ctx.restore();
71090
71101
  } else {
71091
- item.render(context);
71102
+ item.renderWithOpacity(context);
71092
71103
  }
71093
71104
  } else {
71094
- item.render(context);
71105
+ item.renderWithOpacity(context);
71095
71106
  }
71096
71107
  board2.selection.renderItemMbr(context, item, board2.camera.getMatrix().scaleX);
71097
71108
  }
@@ -158,6 +158,7 @@ export declare class BaseItem<T extends BaseItem<any> = any> implements Geometry
158
158
  clearHighlightMbr(): void;
159
159
  renderHoverHighlight(context: DrawingContext): void;
160
160
  render(context: DrawingContext): void;
161
+ renderWithOpacity(context: DrawingContext): void;
161
162
  getSnapAnchorPoints(): Point[];
162
163
  getPointOnEdge(point: Point, _edge?: string): Point;
163
164
  handleTransform(params: TransformParams): TransformResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.14.27",
3
+ "version": "0.14.28",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",