The Incredible SuperCard Shrink Tool

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 122
Joined: Fri Apr 28, 2006 12:10 am

The Incredible SuperCard Shrink Tool

Post by RogGuay » Sun Nov 21, 2021 11:06 pm

I have at times, lamented that I miss the old incredible SuperCard Shrink Tool that gave one the ability to shrink a polygon tightly around any assembly of other objects. I made extensive use of that tool back in the day, and have seen many instances in this forum and the List where this would have been THE solution.

The attached stack is my latest attempt to recreate that tool, but as you can see, it just doesn't cut it! Although the code here is straightforward, it doesn't seem to behave well, You can witness this yourself by simply commenting out the "lock Screen" script.

I am befuddled! If SuperCard can do this, why can't LC? And, what's wrong with my code????

Roger
ShrinkTool.livecode.zip
(3.84 KiB) Downloaded 180 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: The Incredible SuperCard Shrink Tool

Post by dunbarx » Mon Nov 22, 2021 4:27 am

Roger.

I am not understanding how to even start. If I just click on the button, nothing (after a moment) particularly happens. And when you say "commenting out the "lock Screen" script." I do not know what you mean.

Craig

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 122
Joined: Fri Apr 28, 2006 12:10 am

Re: The Incredible SuperCard Shrink Tool

Post by RogGuay » Mon Nov 22, 2021 7:21 am

Very strange. You should see a blue shape (poly) looking vaguely like Rect1 and Rect2 combined after a few seconds. Then if you look at the mouseUp script of the button, you can comment out the Lock Screen in line 6. This will allow you to see how the script is generating this blue poly. I hope that helps and I'm sorry for confusing you.

Roger

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: The Incredible SuperCard Shrink Tool

Post by richmond62 » Mon Nov 22, 2021 9:24 am

Screen shot 2021-11-22 at 10.24.37 AM.png
Screen shot 2021-11-22 at 10.24.37 AM.png (35.22 KiB) Viewed 6588 times
-
Interestingly enough SuperCard does NOT seem to allow
you to set the size of the corner curve on rounded
rectangles:
-
Screen shot 2021-11-22 at 10.17.45 AM.png
-
Though this is an interesting approach:
-
Screen shot 2021-11-22 at 10.18.51 AM.png
-
BUT, I cannot find the Shrink Tool . . . :?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10055
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: The Incredible SuperCard Shrink Tool

Post by FourthWorld » Mon Nov 22, 2021 9:43 am

Was the Shrink tool only in SuperEdit?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: The Incredible SuperCard Shrink Tool

Post by richmond62 » Mon Nov 22, 2021 9:49 am

Screen shot 2021-11-22 at 10.47.45 AM.png
-
Still not sure. :(

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: The Incredible SuperCard Shrink Tool

Post by richmond62 » Mon Nov 22, 2021 10:58 am

SShot 2021-11-22 at 11.56.32.png
-
I wonder how to make those 2 SLIDERS permanently visible?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: The Incredible SuperCard Shrink Tool

Post by dunbarx » Mon Nov 22, 2021 6:34 pm

Ah, I see now. I moved the two shapes around and then clicked the button. I thought the circle was going to shrink around those shapes.

And yes, if the two shapes get too far apart, it breaks down.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: The Incredible SuperCard Shrink Tool

Post by dunbarx » Mon Nov 22, 2021 6:38 pm

Rereading, I see that the point was to have a polygon shrink around a few shapes. But how would this be managed? If any irregular polygon was the object to be shrunk, then choices would have to be made about how to keep as much as possible to the original angles and ratios of the starting shape.

This might be better than to continue working...

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: The Incredible SuperCard Shrink Tool

Post by dunbarx » Mon Nov 22, 2021 6:53 pm

This seems straightforward, if not trivial. If one has an irregular polygon and a control, all you have to do is (pseudo":

Code: Select all

set the loc of the control to the loc of the polygon
break the sides of the polygon into separate lines using the points of that polygon
find the angle that is 90° to each line that "points" inward toward the control
move each line along that angle until intersects the control
trim the inevitable overlaps of the several lines
create a new polygon with the points of all the lines
lose the lines
Will take a stab...

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: The Incredible SuperCard Shrink Tool

Post by richmond62 » Mon Nov 22, 2021 7:11 pm

Stab, stab!

But, why couldn't I find the Shrink Tool in SuperCard?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10055
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: The Incredible SuperCard Shrink Tool

Post by FourthWorld » Mon Nov 22, 2021 7:41 pm

richmond62 wrote:
Mon Nov 22, 2021 7:11 pm
...why couldn't I find the Shrink Tool in SuperCard?
If memory serves, it wasn't a language feature, but a layout convenience added into SC's SuperEdit from SuperPaint:
viewtopic.php?f=9&t=36472&start=30#p210767
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: The Incredible SuperCard Shrink Tool

Post by bn » Mon Nov 22, 2021 8:44 pm

If I understand correctly what the shrink tool did, namely to take a bunch or a single graphic and return the outer contour as a polygone graphic then I have here a stack that can do this.

It does it by taking a snapshot of a group containing graphic and tracing the image for the contour of the resultant composite outline.

I repurposed an old tool of mine for this.

Kind regards
Bernd
Attachments
TraceOutlineOfGraphics.livecode.zip
(14.67 KiB) Downloaded 181 times

stam
Posts: 3092
Joined: Sun Jun 04, 2006 9:39 pm

Re: The Incredible SuperCard Shrink Tool

Post by stam » Mon Nov 22, 2021 9:17 pm

That's amazing Bernd!

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 122
Joined: Fri Apr 28, 2006 12:10 am

Re: The Incredible SuperCard Shrink Tool

Post by RogGuay » Tue Nov 23, 2021 7:22 am

Bernd, you astound me again with your genius. I only had a quick look at how your tracing is done, but that, of course is the trick! I have my work cut out to understand it.

Thanks,
Roger

Post Reply