ARTIST-Association / ARTIST-Association/CANVAS

Improve code quality of picker.mjs

Open
#57 0 comments 0 reactions 1 assignee Claimed by @plhrtr View on GitHub
code quality documentation
Dominant language
Python
Stars
6
Forks
2
PR merge metrics
No merged PRs in 30d

Description

- [x] Add a comment with more info on the normalization in `mouseposition()`
- presumably: normalization to [-1, 1] and inverting the y axis to go from DOM to three.js world space
- [x] Simplify if-statements in `updateSelectionBox()`, `attachSingleTransformControl()`, and `updateSelection()`
- reduce unnecessary nesting of if-statements and merge if-branches with the same outcome/shared code
- set `showX = (axis === "X")` etc directly if possible
- [x] Consistence use of `this.#selectedObject`, `this.#transformControls.object`, and `this.#selectedObjects[0]`
- Should they be identical (in most cases) or are there significant differences?
- If identical → is it sufficient to just use `this.#selectedObject`?
- If not identical → clarify how they differ
- [x] Check if `deselectAll()` should reset the `this.#selectedObject`
- [x] Should `itemSelectedEvent()` be renamed to `dispatchItemSelectedEvent()`?
- [x] In `setUpMouseEvents()`: find a better name for `canvasChild` or add a comment explaining what exactly the last child of canvas is
- [x] Can we use `this.#canvas` in `itemSelectedEvent()`?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.