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

InteractionManager refactoring: extract TreeSearch #6089

Merged
merged 5 commits into from Sep 17, 2019

Conversation

ivanpopelyshev
Copy link
Collaborator

@ivanpopelyshev ivanpopelyshev commented Sep 12, 2019

I've got many ideas how to make our interaction code more clear and moddable.

This is first PR in a sequence: I removed 180 lines of code from huge 1900 lines file and got rid of 2 params in a function call.

Here's the biggest case when we need to inject different search behaviour: https://github.com/pixijs/pixi-layers/blob/master/src/InteractionManagerMixin.ts

Several changes in interaction were the reason why users stuck with particular versions of pixijs.

I need help with testing that thing, but it should be easy - I didnt add any new features, just copied the code&docs and passed params.

Why is it separate class, and not a mixin? I think that after several PR's we'll be able to give ability to use treeSearch for hittesting independently of interaction, and with many optional params, like hittesting several objects. Also, someone might do something like

element.on('mousedown', function() { hereIsAnotherHitTest() } );

right now that kind of constructions can affect delayedEvents and other things. Having search-related local variables (queue?) not as params of recursive function will be handy.

Lets start with easy stuff!

And decide on the name...

@codecov-io
Copy link

codecov-io commented Sep 12, 2019

Codecov Report

Merging #6089 into dev will increase coverage by 0.02%.
The diff coverage is 96.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #6089      +/-   ##
==========================================
+ Coverage   70.87%   70.89%   +0.02%     
==========================================
  Files         208      209       +1     
  Lines       10648    10656       +8     
==========================================
+ Hits         7547     7555       +8     
  Misses       3101     3101
Impacted Files Coverage Δ
packages/interaction/src/InteractionManager.js 93.31% <100%> (-0.15%) ⬇️
packages/interaction/src/TreeSearch.js 95.83% <95.83%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 414b3e9...33ee06d. Read the comment docs.

@pixijs pixijs deleted a comment from katrin80 Sep 13, 2019
Copy link
Member

@bigtimebuddy bigtimebuddy left a comment

Choose a reason for hiding this comment

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

I'm trusting the unit-tests on this one! Code reorg looks good though.

@bigtimebuddy bigtimebuddy added this to the v5.2.0 milestone Sep 13, 2019
@bigtimebuddy bigtimebuddy merged commit 5ba4a94 into dev Sep 17, 2019
@bigtimebuddy bigtimebuddy deleted the dev-interaction-refactor branch September 17, 2019 20:04
@bigtimebuddy
Copy link
Member

Thanks @ivanpopelyshev, good one.

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.

None yet

5 participants