-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
add vertical orientation option to Toggle #4445
Conversation
2af0828
to
73a3bab
Compare
i think so long as the attributes section on this page of the docs get automatically updated then no further change is necessary. but happy to add more if others disagree. |
73a3bab
to
068b632
Compare
I can see a world where one would want to vertical direction to be flipped. It would be cool if |
that's a great suggestion @EdsterG. thanks! using
|
I think the origin is (0, 0), you can probably translate by the negative midpoint first, then rotate, then translate back. |
Ah I think you need to rotate!(Accum, ...) |
nope. neither rotating with Accum with or without translating to 0,0 works. |
I figure it's something like this:
This approach is very fragile though, and I'm not sure if it will scale. This is the perfect example of where a full Mat4f would come in handy to indicate a model, since you can stack transformations on that. |
+1 to this if it's not yet implemented |
I disagree, this is an example of our transformation interface being incomplete. You can rewrite a translate-rotate-translate operation with how our transformations are defined, there is just no convenience function for it. Example: p = rand(Point2f)
rect = Rect2f(p .- 0.1, Vec2f(0.2))
fig = Figure()
sl = Slider(fig[1, 1], range = range(0, 2pi, length=101))
ax = Axis(fig[2, 1], aspect = DataAspect())
p1 = poly!(ax, rect, color = :orange)
p2 = lines!(ax, rect, color = :red)
xlims!(ax, -1.5, 1.5)
ylims!(ax, -1.1, 1.1)
on(sl.value) do angle
center = to_ndim(Vec3f, p, 0)
R = Makie.rotationmatrix_z(angle)
T = Makie.translationmatrix(-center)
Tinv = Makie.translationmatrix(center)
p1.transformation.model[] = Tinv * R * T # Did we break setting plot.model?
R = Makie.rotationmatrix_z(angle)
t = Point3f(R * to_ndim(Point4f, -center, 1))
translate!(p2, center + t)
rotate!(p2, angle)
end
fig |
YES! thanks so much @ffreyer . you are my HERO!!
that being said, a convenience function sure would be convenient :) |
Right - I should have sent a code example with that :D. But agreed that the interface could use some love. Do we actually have tests for arbitrary |
superseded by #4471 |
Probably not? I think passing a model matrix directly wasn't really supposed to be a feature. You were/are supposed to rely on translate/rotate/scale, let |
Description
Fixes #4378 by adding an
orientation
kwarg toToggle
that defaults to:horizontal
and accepts:vertical
too.Type of change
Checklist