@netless/telebox-insider 1.0.0-alpha.4 → 1.0.0-alpha.7

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": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.7",
4
4
  "private": false,
5
5
  "description": "Window widget for Whiteboard",
6
6
  "license": "MIT",
@@ -719,40 +719,42 @@ export class TeleBox {
719
719
  pxIntrinsicCoord,
720
720
  collectorRect,
721
721
  ]) => {
722
+ const styles = maximized
723
+ ? {
724
+ x: 0,
725
+ y: 0,
726
+ width: "100%",
727
+ height: "100%",
728
+ scaleX: 1,
729
+ scaleY: 1,
730
+ }
731
+ : {
732
+ x: pxIntrinsicCoord.x,
733
+ y: pxIntrinsicCoord.y,
734
+ width: pxIntrinsicSize.width + "px",
735
+ height: pxIntrinsicSize.height + "px",
736
+ scaleX: 1,
737
+ scaleY: 1,
738
+ };
722
739
  if (minimized && collectorRect) {
723
- return {
724
- x:
725
- collectorRect.x -
726
- pxIntrinsicSize.width / 2 +
727
- collectorRect.width / 2,
728
- y:
729
- collectorRect.y -
730
- pxIntrinsicSize.height / 2 +
731
- collectorRect.height / 2,
732
- width: pxIntrinsicSize.width + "px",
733
- height: pxIntrinsicSize.height + "px",
734
- scaleX: collectorRect.width / pxIntrinsicSize.width,
735
- scaleY: collectorRect.height / pxIntrinsicSize.height,
736
- };
737
- }
738
- if (maximized) {
739
- return {
740
- x: 0,
741
- y: 0,
742
- width: "100%",
743
- height: "100%",
744
- scaleX: 1,
745
- scaleY: 1,
746
- };
740
+ const boxWidth = maximized
741
+ ? this.rootRect.width
742
+ : pxIntrinsicSize.width;
743
+ const boxHeight = maximized
744
+ ? this.rootRect.height
745
+ : pxIntrinsicSize.height;
746
+ styles.x =
747
+ collectorRect.x -
748
+ boxWidth / 2 +
749
+ collectorRect.width / 2;
750
+ styles.y =
751
+ collectorRect.y -
752
+ boxHeight / 2 +
753
+ collectorRect.height / 2;
754
+ styles.scaleX = collectorRect.width / boxWidth;
755
+ styles.scaleY = collectorRect.height / boxHeight;
747
756
  }
748
- return {
749
- x: pxIntrinsicCoord.x,
750
- y: pxIntrinsicCoord.y,
751
- width: pxIntrinsicSize.width + "px",
752
- height: pxIntrinsicSize.height + "px",
753
- scaleX: 1,
754
- scaleY: 1,
755
- };
757
+ return styles;
756
758
  },
757
759
  { compare: shallowequal }
758
760
  );
@@ -7,7 +7,7 @@
7
7
  visibility: hidden;
8
8
  display: block;
9
9
  position: absolute;
10
- z-index: $base-z-index * 2;
10
+ z-index: $collector-z-index;
11
11
  width: 40px;
12
12
  height: 40px;
13
13
  margin: 0;
@@ -206,8 +206,9 @@ export class TeleBoxManager {
206
206
  ratio$: stageRatio$,
207
207
  root$,
208
208
  highlightStage$: combine(
209
- [highlightStage$, maximized$],
210
- ([highlightStage, maximized]) => highlightStage && !maximized
209
+ [highlightStage$, maximized$, minimized$],
210
+ ([highlightStage, maximized, minimized]) =>
211
+ highlightStage && (minimized || !maximized)
211
212
  ),
212
213
  });
213
214
  this._sideEffect.addDisposer(() => teleStage.destroy());
@@ -34,12 +34,8 @@ export class TeleStage {
34
34
  this.highlightStage$ = highlightStage$;
35
35
 
36
36
  this.stageRect$ = combine(
37
- [rootRect$, highlightStage$, ratio$],
38
- ([rootRect, highlightStage, ratio]) => {
39
- if (!highlightStage) {
40
- return rootRect;
41
- }
42
-
37
+ [rootRect$, ratio$],
38
+ ([rootRect, ratio]) => {
43
39
  if (ratio <= 0 || rootRect.width <= 0 || rootRect.height <= 0) {
44
40
  return rootRect;
45
41
  }
@@ -3,7 +3,7 @@
3
3
  .#{$namespace}-box-stage-container {
4
4
  display: none;
5
5
  position: absolute;
6
- z-index: $base-z-index + 2000;
6
+ z-index: $stage-z-index;
7
7
  top: 0;
8
8
  left: 0;
9
9
  width: 100%;
@@ -1,2 +1,4 @@
1
1
  $namespace: "telebox";
2
2
  $base-z-index: 100;
3
+ $stage-z-index: $base-z-index + 2000;
4
+ $collector-z-index: $stage-z-index + 1;