Skip to content

Commit 1f21466

Browse files
authored
Merge pull request #1 from maxxfrazer/hide-no-scene
- Hide pin when entity is not in a scene
2 parents 44854c3 + 43ec2e2 commit 1f21466

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/RKPointPin/RKPointPin.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,16 @@ public class RKPointPin: UIView {
185185
guard let ent = self.targetEntity,
186186
ent.scene != nil,
187187
let projPoint = arView.project(ent.position(relativeTo: nil)) else {
188-
if self.pinBody.isHidden {
189-
// hide because we do not want to show it now
188+
if !self.pinBody.isHidden {
189+
// hide pin if it is showing
190+
self.pinBody.isHidden = true
190191
}
191192
return
192193
}
194+
if self.pinBody.isHidden {
195+
// show pin if it is hidden
196+
self.pinBody.isHidden = false
197+
}
193198
let matrixZAxis = arView.cameraTransform.matrix.columns.2
194199
let zFacing: SIMD3<Float> = [matrixZAxis.x, matrixZAxis.y, matrixZAxis.z]
195200
let toEntityDirection = ent.position(relativeTo: nil) - arView.cameraTransform.translation

0 commit comments

Comments
 (0)