Path of canvas

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Path of canvas

Post by [-hh] » Thu Sep 01, 2016 11:11 pm

Is there a way to get (the instructions of) "the current path of this canvas"?
So that the following is possible

Code: Select all

constrainPathToRect(my bounds,the current path of this canvas)
shiftLock happens

peter-b
Posts: 182
Joined: Thu Nov 20, 2014 2:14 pm
Location: LiveCode Ltd.

Re: Path of canvas

Post by peter-b » Fri Sep 02, 2016 3:55 pm

I don't think it's currently available. Can you give an example of what problem you would be able to solve using this that could not otherwise be handled a different way?
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Path of canvas

Post by [-hh] » Fri Sep 02, 2016 4:45 pm

I'm building a LCDscroller widget, just like the HTML5 example.
Currently I'm transforming non-linear (for example to a sine wave) a set of points by

Code: Select all

[*] add circle path centered at point transformLCD(pX, pY) with radius tRadius to this canvas
and the problem is to fit this path to the current bounds of the widget or to resize the widget correspondingly so that nothing is cropped by its bounds.
[Computing the 'geometric extents' costs too much time.]

The line [*] above is my trial to have "markers" like in LC script.
shiftLock happens

peter-b
Posts: 182
Joined: Thu Nov 20, 2014 2:14 pm
Location: LiveCode Ltd.

Re: Path of canvas

Post by peter-b » Fri Sep 02, 2016 5:00 pm

When I have this problem, I normally transform the canvas (using "scale tCanvas by tScale" and "translate tCanvas by tVector") so that the area I intend to draw into has unit height and width and located at the origin. Then it is very easy to position and scale your graphics correctly!
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com

Post Reply

Return to “LiveCode Builder”