I created a custom tile map of my factory floor. I can pan and zoom in the map component. When I drag the map to the edge of map bounds, I start getting a thousand "listener not found" errors each second causing slow downs and eventual site hangup.
It seems to come from this section of code but I don't know where to go from here.
Hello,
I'm having the same 'listener not found' issue using Ignition 8.1, did you find the solution to your problem ?
The errors seems to affect flyTo and zoom on the map too...
Hi,
I have the same issue with tile maps using 8.1
The issue appears to have been fixed in recent Leaflet versions. Does anyone know if this was fixed by a more recent Ignition version ?
I got no response and stopped pursuing this feature, no idea if its fixed.
Thank you for your response!
I ended up using 'onMoveEnd' on the Map component and completely removing the maxBounds, I have no more errors.
If someone encounters this problem, here is a script that I created quickly, it allows the user to exceed limits while creating a "bounce" effect when they do so. It’s not as good or as effective as an integrated limit manager would be, but it works fine for my use case.
Put this on the onMoveEnd event as a Script and add these as customs :
mapLimits : {"maxLat": "XX.XX","maxLng": "XX.XX","minLat": "XX.XX","minLng": "XX.XX","tolerance": "0.001"}
mapMoveGuard : false
if self.custom.mapMoveGuard:
self.custom.mapMoveGuard = False
return
limits = self.custom.mapLimits
allowedMinLat = float(limits["minLat"])
allowedMaxLat = float(limits["maxLat"])
allowedMinLng = float(limits["minLng"])
allowedMaxLng = float(limits["maxLng"])
tolerance = float(limits.get("tolerance", 0.001))
b = self.getBounds()
viewSouth = b["south"]
viewNorth = b["north"]
viewWest = b["west"]
viewEast = b["east"]
if (
viewSouth >= (allowedMinLat - tolerance) and
viewNorth <= (allowedMaxLat + tolerance) and
viewWest >= (allowedMinLng - tolerance) and
viewEast <= (allowedMaxLng + tolerance)
):
return
center = self.getCenter()
centerLat = center["lat"]
centerLng = center["lng"]
halfHeight = (viewNorth - viewSouth) / 2.0
halfWidth = (viewEast - viewWest) / 2.0
minCenterLat = allowedMinLat + halfHeight
maxCenterLat = allowedMaxLat - halfHeight
minCenterLng = allowedMinLng + halfWidth
maxCenterLng = allowedMaxLng - halfWidth
def clamp(value, minValue, maxValue):
return max(minValue, min(value, maxValue))
if minCenterLat > maxCenterLat:
newLat = (allowedMinLat + allowedMaxLat) / 2.0
else:
newLat = clamp(centerLat, minCenterLat, maxCenterLat)
if minCenterLng > maxCenterLng:
newLng = (allowedMinLng + allowedMaxLng) / 2.0
else:
newLng = clamp(centerLng, minCenterLng, maxCenterLng)
if abs(newLat - centerLat) > tolerance or abs(newLng - centerLng) > tolerance:
self.custom.mapMoveGuard = True
zoomPanOptions = {
"animate": False,
"duration": 0,
"easeLinearity": 0,
"noMoveStart": False
}
self.panTo({"lat": newLat, "lng": newLng}, option=zoomPanOptions)