@netless/telebox-insider 0.2.21 → 0.2.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/telebox-insider",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "private": false,
5
5
  "description": "Window widget for Whiteboard",
6
6
  "license": "MIT",
@@ -458,8 +458,11 @@ export class TeleBoxManager {
458
458
  }
459
459
  });
460
460
  box._zIndex$.reaction((_, __, skipUpdate) => {
461
- if (this.topBox && box.zIndex > this.topBox.zIndex) {
462
- this.topBox$.setValue(box);
461
+ if (this.boxes.length > 0) {
462
+ const topBox = this.boxes.reduce((topBox, box) =>
463
+ topBox.zIndex > box.zIndex ? topBox : box
464
+ );
465
+ this.topBox$.setValue(topBox);
463
466
  }
464
467
  if (!skipUpdate) {
465
468
  this.events.emit(TELE_BOX_MANAGER_EVENT.ZIndex, box);
@@ -734,7 +737,6 @@ export class TeleBoxManager {
734
737
  if (this.topBox) {
735
738
  if (box !== this.topBox) {
736
739
  box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
737
- this.topBox$.setValue(box);
738
740
  }
739
741
  }
740
742
  }