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

Modified scale resets after dragging/rotating model #427

Open
dariuslung opened this issue Jul 30, 2024 · 0 comments
Open

Modified scale resets after dragging/rotating model #427

dariuslung opened this issue Jul 30, 2024 · 0 comments
Labels
🪲 bug Something isn't working

Comments

@dariuslung
Copy link

Describe the bug
I am trying to modify the scale of a model in realtime, so I resorted to obj.set({scale: [x, y, z]}) and it does work as long as I don't drag or rotate the model. Otherwise it gets reset to the original value.

To Reproduce
Steps to reproduce the behavior:

  1. Add a model to threebox
  2. Manually override the scale with obj.set() or obj.scale.set()
  3. Drag or rotate the model
  4. Scale gets reset

Expected behavior
Scale should stay as set?

Relevant Code

const step = 0.1;
window.addEventListener('keydown', function (event) {
    switch (event.key) {
        case '+':
        case '=':
            // PROBLEM Resets upon moving/rotating
            curScale.x += step;
            curScale.y += step;
            curScale.z += step;
            myModel.set({ scale: [curScale.x, curScale.y, curScale.z]});
            console.log(curScale);
            tb.map.repaint = true;
            break;
        case '-':
        case '_':
            curScale.x -= step;
            curScale.y -= step;
            curScale.z -= step;
            myModel.set({ scale: [curScale.x, curScale.y, curScale.z]});
            console.log(curScale);
            tb.map.repaint = true;
            break;
    }
});
  • Version 2.2.7
@dariuslung dariuslung added the 🪲 bug Something isn't working label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant