isTapped method
returns true if the position specified by tapEvent
is in the area of
this marker. Note that tapEvent represents the position at the time the
tap has been executed.
Implementation
@override
bool isTapped(TapEvent tapEvent) {
if (_lastZoomLevel != tapEvent.projection.scalefactor.zoomlevel) {
// zoomLevel changed, set _coordinatesAbsolute cache to null
nodeProperties.clearCache();
}
_lastZoomLevel = tapEvent.projection.scalefactor.zoomlevel;
Mappoint absolute = nodeProperties.getCoordinatesAbsolute(tapEvent.projection);
Mappoint tapped = tapEvent.projection.latLonToPixel(tapEvent);
MapRectangle boundary = base.calculateBoundary();
bool tpd = tapped.x >= absolute.x + boundary.left &&
tapped.x <= absolute.x + boundary.right &&
tapped.y >= absolute.y + boundary.top &&
tapped.y <= absolute.y + boundary.bottom;
// print(
// "src: ${base.bitmapSrc}, tapX: ${tapped.x}, absolute: ${absolute.x}, boundary: ${boundary.left} ${boundary.right}");
// print(
// "src: ${base.bitmapSrc}, tapY: ${tapped.y}, absolute: ${absolute.y}, boundary: ${boundary.top} ${boundary.bottom}");
// print("src: ${base.bitmapSrc}, tapped: $tpd");
return tpd;
}