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

OrbitControls: Add stopListenToKeyEvents(). #25418

Merged
merged 5 commits into from
Feb 11, 2023
Merged

Conversation

nikolas
Copy link
Contributor

@nikolas nikolas commented Feb 2, 2023

If I called listenToKeyEvents(), sometimes I want to remove this event listener, temporarily or otherwise.

If I called listenToKeyEvents(), sometimes I want to remove this event
listener, temporary or otherwise.
@Mugen87 Mugen87 changed the title Add OrbitControls.removeKeyEvents() OrbitControls: Add unlistenToKeyEvents(). Feb 10, 2023
@Mugen87 Mugen87 added this to the r150 milestone Feb 10, 2023
@WestLangley
Copy link
Collaborator

"unlisten" is not a word. Is there a better API? 🤔

Also, maybe set this._domElementKeyEvents = null; on .dispose().

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 10, 2023

"unlisten" is not a word. Is there a better API?

from https://ell.stackexchange.com/questions/214085/is-there-any-word-for-unlisten-negative-of-listen

In the context of programming, it's better to be clear than to try and force "correct" English.

TBH, I feel very strong about this statement.

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 10, 2023

Also, maybe set this._domElementKeyEvents = null; on .dispose().

Good catch! I'll update the PR.

@WestLangley
Copy link
Collaborator

In the context of programming, it's better to be clear than to try and force "correct" English.

TBH, I feel very strong about this statement.

That's fine. But if you are using "unlisten" to mean "stop listening", then use stopListeningToKeyEvents.

That's both correct and clear.

Or stopListenKeyEvents.

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 11, 2023

How about stopListenToKeyEvents()? I think it's better for programming when the listenToKeyEvents() term is the same for both methods.

@WestLangley
Copy link
Collaborator

Oh yes. (That was a typo.)

@Mugen87 Mugen87 changed the title OrbitControls: Add unlistenToKeyEvents(). OrbitControls: Add stopListenToKeyEvents(). Feb 11, 2023
@Mugen87 Mugen87 merged commit a2a1711 into mrdoob:dev Feb 11, 2023
@Mugen87 Mugen87 mentioned this pull request Feb 11, 2023
@mrdoob
Copy link
Owner

mrdoob commented Feb 14, 2023

"unlisten" is not a word. Is there a better API? 🤔

Can we make it a word? 😅

How about ignoreKeyEvents()?

listenKeyEvents()
ignoreKeyEvents()

I don't like that "To" in the name... 😕

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 14, 2023

The *to* names were discussed here: #21054 (comment).

I'm okay with the shorter version as well :)

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