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

rect bug when parameters are clamped #7

Open
micuat opened this issue Jul 12, 2020 · 2 comments
Open

rect bug when parameters are clamped #7

micuat opened this issue Jul 12, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@micuat
Copy link
Contributor

micuat commented Jul 12, 2020

https://glisp.app/commit:69e6023/?code_url=https%3A%2F%2Fgist.githubusercontent.com%2Fmicuat%2Ff8b1e0001efcf2115bca90dcbee93979%2Fraw%2F9d24021efc890dc514710bd0805c32cca9d69384%2Fclamprectbug.glisp

(defvar vx 100)
(defvar vy -55.20002746582031)

(def W 100)
(def H 100)
(background "aliceblue")

(style (stroke "salmon" 2)
	(rect [(clamp vx (- W) W) (clamp vy (- H) H) 341.5 279.00096130371094]))

in this case, when x y are bound by clamp, width and height still moves in an unexpected way (I guess it's trying to compensate values somehow)

@baku89
Copy link
Owner

baku89 commented Jul 12, 2020

I guess it's because I used :delta-pos (stores the delta of mouse position from previous function call literally) for some of the handles.

https://github.com/baku89/glisp/blob/master/public/lib/math.glisp#L671-L683

It might be better not to calculate new parameters incrementally in some cases.
(Though :prev-pos and :delta-pos are still needed for a handle like a rotary knob)

baku89 added a commit that referenced this issue Jul 18, 2020
@baku89
Copy link
Owner

baku89 commented Jul 18, 2020

Even I refactored the drag function of rect2d not to update incrementally, though, the problem does not seem to be fixed yet. Will try to investigate what's going on inside the reverse evaluation.

Thank you for a lot of feedback anyway!

@baku89 baku89 added the bug Something isn't working label Jul 18, 2020
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

2 participants