You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Objects are later loaded into the scene in this manner.
function addObjects(e) {
// Create the object.
const entity = document.createElement("a-box")
entity.setAttribute("scale", {
x: 20,
y: 20,
z: 20
})
entity.setAttribute('material', { color: 'red' } )
entity.setAttribute('gps-new-entity-place', {
latitude: e.detail.position.latitude + 0.001,
longitude: e.detail.position.longitude
})
// Set up the click handler.
entity.addEventListener("click", (evt) => {
alert("I was clicked!")
})
// Add the object to the scene.
const scene = document.querySelector("a-scene")
scene.appendChild(entity)
}
When tapping on an object in the scene, the "click" event handler is called successfully on iOS but is NOT called on Android.
What is the current behavior?
From my debugging, I determined that the "click" event is emitted from the "cursor" component's onCursorUp() method. But this method is only called if the "raycaster" component finds intersections in its checkIntersections() method. This method finds those intersections by calling into the three.js Raycaster.intersectObjects() method.
The Raster.intersectObjects() methods returns intersections on iOS, but does not return them on Android.
Note: This solution works on both platforms if the scene is implemented statically using the same markup for the scene. However our application requires the dynamic approach described above.
If the current behavior is a bug, please provide the steps to reproduce.
The attached bug.html file provides a simplified implementation of our approach that demonstrates the failure on Android while working successfully on iOS. Tap on the "Get started" button to load the view. The find and tap on the red box in the scene. If successful an alert will show. bug.html.zip
Please mention other relevant information such as the browser version, Operating System and Device Name
Testing on iOS 17.3 (iPhone 15 Pro Max) and Android 13 (Pixel 6a)
What is the expected behavior?
Click events should work on both iOS and Android.
If this is a feature request, what is motivation or use case for changing the behavior?
The text was updated successfully, but these errors were encountered:
im-a-rocketman
changed the title
[Android]
"click" events are not emitted on Android when scene is created dynamically
Feb 22, 2024
im-a-rocketman
changed the title
"click" events are not emitted on Android when scene is created dynamically
"click" events are not emitted on Android when scene is loaded dynamically
Feb 22, 2024
Do you want to request a feature or report a bug? Bug
Our application uses the following approach to dynamically load an embedded scene into a DIV element on the page.
Objects are later loaded into the scene in this manner.
When tapping on an object in the scene, the "click" event handler is called successfully on iOS but is NOT called on Android.
What is the current behavior?
From my debugging, I determined that the "click" event is emitted from the "cursor" component's onCursorUp() method. But this method is only called if the "raycaster" component finds intersections in its checkIntersections() method. This method finds those intersections by calling into the three.js Raycaster.intersectObjects() method.
The Raster.intersectObjects() methods returns intersections on iOS, but does not return them on Android.
Note: This solution works on both platforms if the scene is implemented statically using the same markup for the scene. However our application requires the dynamic approach described above.
If the current behavior is a bug, please provide the steps to reproduce.
The attached bug.html file provides a simplified implementation of our approach that demonstrates the failure on Android while working successfully on iOS. Tap on the "Get started" button to load the view. The find and tap on the red box in the scene. If successful an alert will show.
bug.html.zip
Please mention other relevant information such as the browser version, Operating System and Device Name
Testing on iOS 17.3 (iPhone 15 Pro Max) and Android 13 (Pixel 6a)
What is the expected behavior?
Click events should work on both iOS and Android.
If this is a feature request, what is motivation or use case for changing the behavior?
The text was updated successfully, but these errors were encountered: