-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove double click handlers from nebula layers and edit-modes #410
Conversation
Pull Request Test Coverage Report for Build 1968
💛 - Coveralls |
0198c88
to
914ab0e
Compare
@@ -1021,8 +1021,7 @@ export default class Example extends React.Component< | |||
id: 'basemap', | |||
controller: { | |||
type: MapController, | |||
// @ts-ignore | |||
doubleClickZoom: this.state.mode === 'view' && !this.state.selectionTool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like disabling double click to zoom will make nebula feel more snappy and responsive since deck won't debounce clicks with doubleClickZoom: false
. In my opinion, the benefits of this change outweigh the utility that double click to zoom provides.
@@ -308,12 +307,6 @@ export default class ModeHandler extends React.PureComponent<EditorProps, Editor | |||
this._modeHandler.handleClick(event, modeProps); | |||
}; | |||
|
|||
_onDblclick = (event: BaseEvent) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react-map-gl-draw is not using deck.gl as renderer. so this should be kept.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I'll revert my changes in the react-map-gl-draw
module.
With the current implementation, all layers that extend
EditableLayer
add event handlers for thedblclick
event even whenEditableLayer.onDoubleClick()
isn't overridden. The problem is that deck.gl performs click debouncing whendblclick
handler is provided, making clicks feel laggy and in some cases, drop clicks altogether.The following is how
EditableLayers
currently behave. Notice the delay in the layer's response after clicking on features:Here is how the layer behaves after applying this diff:
As a side note, if a single layer adds a
dblclick
handler, all deck layers will experience this debouncing effect. Because of this, I do not recommend that any layers adddblclick
handlers.