you are passing a Marker object to the Marker constructor, this won't work. I'm not 100% sure what you are trying to achieve but please take a look at the code below, it should help. If the user clicks on a Marker, all Markers will be deleted and the same Markers will be recreated. The implementation is just to give you a rough guide and should be optimized.
onMarkerSelected: function onMarkerSelectedFn(marker) { World.markerList = ; AR.context.destroyAll();
// Create an AR.ImageResource for the marker idle-image World.markerDrawable_idle = new AR.ImageResource("assets/marker_idle.png"); // Create an AR.ImageResource for the marker selected-image World.markerDrawable_selected = new AR.ImageResource("assets/marker_selected.png"); // Create an AR.ImageResource referencing the image that should be displayed for a direction indicator. World.markerDrawable_directionIndicator = new AR.ImageResource("assets/indi.png");
/* To be able to deselect a marker while the user taps on the empty screen, the World object holds an array that contains each marker. */ World.markerList.push(new Marker(singlePoi)); }
},
For this to work, add following line to requestDataFromLocal function:
// request POI data requestDataFromLocal: function requestDataFromLocalFn(centerPointLatitude, centerPointLongitude) { ... World.poiData = poiData; World.loadPoisFromJsonData(poiData); }
I hope that helps.
Best regards, Simon
E
Epic Ar
said
about 8 years ago
Thanks Simon so much .. I need to remove the selected POI Itself from camera ,
I solve it using these lines of code inside onMarkerSelectedFn
Epic Ar