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

Editor: Add SelectionHelper for Viewport. #23902

Merged
merged 10 commits into from
May 26, 2022

Conversation

linbingquan
Copy link
Contributor

@linbingquan linbingquan commented Apr 15, 2022

Related issue: #23464

Description

I'm not sure this is the best implementation of the SelectionHelper component.

Other plugin can receive raycaster.intersectObjects in #viewport with Signal intersects function like:

editor.signals.intersects.add( ( intersects ) => {
    // do some thing.

    // stop SelectionHelper
    return false;
} , null, 1 );

If there is no problem, I will continue to implement plugin register API.

Please provide feedback.

Todo List

  • Add Signal intersects function in Editor.js.
  • Extract SelectionHelper component.
  • Implement plugin register API for editor.
  • Provide the method to prevent execute SelectionHelper logic, like DOM event's preventDefault().

@linbingquan linbingquan changed the title wip(editor): Add SelectPlugin for Editor. wip(editor): Add SelectionHelper for Editor. Apr 15, 2022
@linbingquan linbingquan changed the title wip(editor): Add SelectionHelper for Editor. Editor: Add SelectionHelper for Viewport. Apr 16, 2022
@linbingquan linbingquan marked this pull request as ready for review April 16, 2022 03:55
editor/js/Editor.js Outdated Show resolved Hide resolved
@Mugen87 Mugen87 added this to the r140 milestone Apr 16, 2022
@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 16, 2022

@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 16, 2022

Looking good! The only thing I have noticed is that SelectionHelper needs to be added to sw.js right here:

three.js/editor/sw.js

Lines 188 to 192 in f9d1f84

'./js/Viewport.js',
'./js/Viewport.Camera.js',
'./js/Viewport.Info.js',
'./js/Viewport.ViewHelper.js',
'./js/Viewport.VR.js',

@linbingquan
Copy link
Contributor Author

Looking good! The only thing I have noticed is that SelectionHelper needs to be added to sw.js right here:

Good job. Thank you for your advice. I wasn't aware of sw.js.

@mrdoob mrdoob modified the milestones: r140, r141 Apr 30, 2022
@mrdoob mrdoob merged commit eb59abb into mrdoob:dev May 26, 2022
@mrdoob
Copy link
Owner

mrdoob commented May 26, 2022

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented May 26, 2022

Renamed SelectionHelper to Selector: 909350e

@mrdoob
Copy link
Owner

mrdoob commented May 26, 2022

The editor broke because there is a lot of references to editor.selected. Here's my fix: 4e0930a

abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* wip(editor): Add SelectPlugin for Editor.

* fix(editor): Fixed SelectionHelper priority to minimum priority.

* Remove useless code.

* fix(editor): Remove SelectionHelper priority.

* Clean up.

* Clean up.

* Clean up.

* Fix error.

* Rename intersects -> intersectionsDetected

* Add SelectionHelper for sw.js
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.

3 participants