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
When drawing a polygon on a map, the polygon is not drawn in the same points where I click. (on the other hand deck.gl appears to compensate properly for CSS transforms)
We have worked around this issue with the following hack (which we had in place when using nebula.gl too)
/** * This code hacks editable-layers to make the getScreenCoords function work with a CSS scale transformation applied */exportconstapplyEditableGeoJsonLayerOverrides=()=>{EditableGeoJsonLayer.prototype.getScreenCoords=(function(this: EditableGeoJsonLayer,pointerEvent: any): [number,number]{constcanvas=this.context.device.getCanvasContext().canvasasHTMLCanvasElement;constrect=canvas.getBoundingClientRect();constscaleX=rect.width/canvas.offsetWidth;constscaleY=rect.height/canvas.offsetHeight;return[(pointerEvent.clientX-rect.left-canvas.clientLeft)/scaleX,(pointerEvent.clientY-rect.top-canvas.clientTop)/scaleY];});};
Module
Description
When drawing a polygon on a map, the polygon is not drawn in the same points where I click. (on the other hand deck.gl appears to compensate properly for CSS transforms)
Expected Behavior
No response
Steps to Reproduce
Draw a polygon here https://codesandbox.io/p/sandbox/deck-gl-community-editable-layers-css-scale-bug-xzy7zr
Environment
Logs
No response
The text was updated successfully, but these errors were encountered: