Skip to content

Conversation

Pessimistress
Copy link
Collaborator

  • Update EventManager
  • Add isDown property to pointer events
  • Prevent picking when dragging

* Process the event deregistration for a single event + handler.
*/
_removeEventHandler(event, handler) {
let success = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: call this eventHandlerRemoved to be a bit more explicit about what succeeded

};

// Calculate center relative to the root element
// TODO/xiaoji - avoid using getBoundingClientRect for perf?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you decide this is not a perf concern?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't find it prominent during profiling.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May not be conclusive. It reportedly depends on the surrounding DOM, how deep we are in the DOM tree, styling etc.

Whether it is worth the trouble to avoid I don't know...

if (alias) {
// fire all events aliased to srcEvent.type
const emitEvent = Object.assign({}, event, {type: alias});
const emitEvent = Object.assign({}, event, {isDown: true, type: alias});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you're always setting isDown: true here, should the third Object.assign() param be the second?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're overriding event.type.

@ericsoco
Copy link
Contributor

Worth noting that this PR fixes the more obvious perf problem during dragging (perf slows down the screen update while dragging), but not the more subtle perf problem that happens when running picking on hover (mousemove without mousedown). The latter is for a future PR.

};

// Calculate center relative to the root element
// TODO/xiaoji - avoid using getBoundingClientRect for perf?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May not be conclusive. It reportedly depends on the surrounding DOM, how deep we are in the DOM tree, styling etc.

Whether it is worth the trouble to avoid I don't know...

import WheelInput from './wheel-input';
import MoveInput from './move-input';
import {isBrowser} from '../globals';
import {isBrowser} from '../../lib/utils/globals';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these utils should be moved up a level if they are no longer used only inside lib.

*/
_onPointerMove(event) {
if (event.isDown) {
// Is dragging
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a little more to the comment i.e. why does dragging mean that we don't need move events?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment means we should not fire pointermove event when mouse is down because pointermove leads to pickLayer getting called. Yes, we probably want to explain a bit more in the comments, or considering put a link to this PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, more specifically _onPointerMove feeds into our hover handlers (onHover and onLayerHover), and dragging is not supported by the framework itself, it's the app's responsibility. But yeah, fleshing out the comment will help future detective work.

@@ -1,15 +0,0 @@
// Purpose: include this in your module to avoids adding dependencies on
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this deleted?

@Pessimistress Pessimistress merged commit 08c389d into master Jul 11, 2017
@Pessimistress Pessimistress deleted the events branch July 11, 2017 21:20
@Pessimistress
Copy link
Collaborator Author

#769

gnavvy pushed a commit that referenced this pull request Jul 12, 2017
- Update EventManager
- Add `isDown` property to pointer events
- Prevent picking when dragging
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