How to make a shape resizable?
John Hendrikx
hjohn at xs4all.nl
Tue Jul 30 14:57:18 UTC 2024
What do you mean by resizable? Like you can select and resize a
rectangle like a Window? You want to be able to zoom in/out using the
scroll wheel?
If you want to make each individual rectangle resizable, you probably
want to use Nodes, probably a Shape node or one of its sub types. You
can then add support for handling certain events (like drags, clicks,
scrolls).
If you want to make some sort of drawing in a Canvas, and you want to
zoom in/out and/or pan the view, you'll have to redraw the contents of
the Canvas. I've done this before, where I was displaying a map in a
Canvas that allowed the user to zoom in/out and pan the view. Redrawing
a map consisting of 10.000's of elements was quite responsive still.
--John
On 30/07/2024 13:02, Davide Perini wrote:
> Hi there,
> is there an easy way to make a shape resizable?
>
> Suppose that I draw a rectangle with
> gc.fillRect(x, y, z, h);
> How am I supposed to make that shape resizable?
> I know that I can do it by draw the entire canvas again but it is very
> tricky.
>
> Is there something that may help me doing it?
>
> Thanks
> Davide
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-discuss/attachments/20240730/4536eecf/attachment.htm>
More information about the openjfx-discuss
mailing list