MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / handleTap

Method handleTap

CodenameOne/src/com/codename1/maps/MapView.java:596–617  ·  view source on GitHub ↗
(int lx, int ly)

Source from the content-addressed store, hash-verified

594 }
595
596 private void handleTap(int lx, int ly) {
597 // Hit-test markers first (top-most wins).
598 for (int i = markers.size() - 1; i >= 0; i--) {
599 Marker m = (Marker) markers.get(i);
600 if (!m.isVisible() || m.getOnClick() == null) {
601 continue;
602 }
603 Point p = engine.latLngToScreen(m.getPosition());
604 int w = m.getIcon() != null ? m.getIcon().getWidth() : 16;
605 int h = m.getIcon() != null ? m.getIcon().getHeight() : 16;
606 int left = p.getX() - (int) (w * m.getAnchorU());
607 int top = p.getY() - (int) (h * m.getAnchorV());
608 if (lx >= left && lx <= left + w && ly >= top && ly <= top + h) {
609 m.getOnClick().actionPerformed(new ActionEvent(m, lx, ly));
610 return;
611 }
612 }
613 LatLng geo = engine.screenToLatLng(lx, ly);
614 for (Object tapListener : tapListeners) {
615 ((MapTapListener) tapListener).mapTapped(this, geo, lx, ly);
616 }
617 }
618
619 private void fireCameraChanged() {
620 if (cameraListeners.isEmpty()) {

Callers 1

pointerReleasedMethod · 0.95

Calls 15

isVisibleMethod · 0.95
getOnClickMethod · 0.95
getPositionMethod · 0.95
getIconMethod · 0.95
getXMethod · 0.95
getAnchorUMethod · 0.95
getYMethod · 0.95
getAnchorVMethod · 0.95
mapTappedMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
latLngToScreenMethod · 0.65

Tested by

no test coverage detected