@webspatial/platform-visionos 0.1.3 → 0.1.5

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": "@webspatial/platform-visionos",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Used to publish WebSpatial projects to Apple Vision Pro",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -18,6 +18,9 @@ struct OptionalClip<Content: View>: View {
18
18
  }
19
19
  }
20
20
 
21
+ // zIndex() have some bug, so use zOrderBias to simulate zIndex effect
22
+ let zOrderBias = 0.001
23
+
21
24
  struct SpatialWebViewUI: View {
22
25
  @Environment(SpatialEntity.self) var ent: SpatialEntity
23
26
  var body: some View {
@@ -38,7 +41,7 @@ struct SpatialWebViewUI: View {
38
41
  let view = childWindowcomponent
39
42
  let x = CGFloat(e.modelEntity.position.x)
40
43
  let y = CGFloat(e.modelEntity.position.y - (view.scrollWithParent ? parentYOffset : 0))
41
- let z = CGFloat(e.modelEntity.position.z)
44
+ let z = CGFloat(e.modelEntity.position.z) + (e.zIndex * zOrderBias)
42
45
  let width = CGFloat(view.resolutionX)
43
46
  let height = CGFloat(view.resolutionY)
44
47
  let anchor = view.rotationAnchor
@@ -66,7 +69,6 @@ struct SpatialWebViewUI: View {
66
69
 
67
70
  .position(x: x, y: y)
68
71
  .offset(z: z)
69
- .zIndex(e.zIndex)
70
72
  .gesture(
71
73
  DragGesture()
72
74
  .onChanged { gesture in