Skip to content
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

Merged
merged 2 commits into from
Jun 5, 2020

Conversation

austintang
Copy link
Collaborator

@austintang austintang commented May 30, 2020

With the current implementation, all layers that extend EditableLayer add event handlers for the dblclick event even when EditableLayer.onDoubleClick() isn't overridden. The problem is that deck.gl performs click debouncing when dblclick 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:
debounced_clicks

Here is how the layer behaves after applying this diff:
fast_click

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 add dblclick handlers.

@coveralls
Copy link

coveralls commented May 30, 2020

Pull Request Test Coverage Report for Build 1968

  • 0 of 4 (0.0%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.006%) to 7.672%

Changes Missing Coverage Covered Lines Changed/Added Lines %
modules/layers/src/layers/editable-layer.ts 0 2 0.0%
modules/main/src/lib/nebula.ts 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
modules/main/src/lib/nebula.ts 2 0%
Totals Coverage Status
Change from base Build 1960: 0.006%
Covered Lines: 359
Relevant Lines: 4856

💛 - Coveralls

@@ -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,
Copy link
Collaborator Author

@austintang austintang Jun 1, 2020

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) => {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

@austintang austintang changed the title Conditionally add double click handler in EditableLayer Remove double click handlers from nebula layers and edit-modes Jun 2, 2020
@supersonicclay supersonicclay merged commit 95e8b94 into master Jun 5, 2020
@austintang austintang deleted the atang-dblclick-event branch September 22, 2020 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants