Page 2 of 2
Re: Need clean image
Posted: Wed May 18, 2022 9:50 am
by bn
Craig,
you could move an open polygon with a bit of cheating. It involves an image at 99% transparency that gets the mouse events and passes them to an enclosing group. Script is in the group.
Kind regards
Bernd
PS I immensely enjoyed your flash-talk at the 2022 developer conference. Wow.
Re: Need clean image
Posted: Wed May 18, 2022 10:04 am
by richmond62
You could, of course, do what I did with 3 graphics in a group, and a script in the group.
Re: Need clean image
Posted: Wed May 18, 2022 10:55 am
by bn
richmond62 wrote: Wed May 18, 2022 10:04 am
You could, of course, do what I did with 3 graphics in a group, and a script in the group.
No I could not. One of many reasons would be that it is hard to grab (relatively small width)
If I would do that though I would change the code e.g. for image "RV" to
Code: Select all
local sRunning, sXDiff, sYLoc
on mouseDown
put the clickLoc into tClick
put the loc of me into tLoc
put item 1 of tClick - item 1 of tLoc into sXDiff
put item 2 of tLoc into sYLoc
put true into sRunning
end mouseDown
on mouseMove x,y
if not sRunning then exit mouseMove
lock screen
put x - sXDiff into tNewX
set the loc of me to tNewX, sYLoc
put the right of me into RITE
put the left of img "LV" into LLL
put (RITE - LLL) into LENF
set the width of img "HOR" to LENF
set the left of img "HOR" to LLL
unlock screen
end mouseMove
on mouseUp
lock screen
put false into sRunning
end mouseUp
Can you spot the difference?
Kind regards
Bernd
Re: Need clean image
Posted: Wed May 18, 2022 11:21 am
by richmond62
No I could not.
Of course you COULD, but you WILL NOT.
A group would NOT have a small width to grab,
Re: Need clean image
Posted: Wed May 18, 2022 2:31 pm
by dunbarx
Lots of hubbub.
I use this in the card script to dynamically adjust the width/height of these thin "brackets", which are used to annotate the locations and extents of various circuits in a drawing. For the horizontal versions:
Code: Select all
on mouseStillDown
if the controlKey is down then set the width of the target to the width of the target + 3
else if the commandKey is down then set the width of the target to the width of the target - 3
end mouseStillDown
on mouseMove
if the mouse is down then set the loc of me to the mouseLoc
end mouseMove
Works fine. The actual handlers only work if the target has certain custom properties set. The user can "grab" these objects, place them as required, then adjust their dimensions by eye.
That was never the problem. I rarely use images or graphics, but I am getting by fairly well with the new graphic gadgets tweaked by Mark W. The issue I had with images is that the line widths varied as the dimensions did. Polygons are constant.
Craig
Re: Need clean image
Posted: Wed May 18, 2022 2:35 pm
by richmond62
Lots of hubbub.
Healthy Hubbub can be an education in itself.
Re: Need clean image
Posted: Wed May 18, 2022 2:37 pm
by dunbarx
Richard.
Yes, fall apart.
In development at least, the polygons are a bit fragile, in that after playing with them I have inadvertently done things that close that last side. I am putting in defenses against that happening. It is possible that once these things are built and only users, er, use them, and my meddling stops, they will likely be stable.
Craig
Re: Need clean image
Posted: Wed May 18, 2022 2:40 pm
by dunbarx
Bernd.
Thanks for the compliment.
you could move an open polygon with a bit of cheating. It involves an image at 99% transparency that gets the mouse events and passes them to an enclosing group. Script is in the group.
I have played with such "compound" controls but am going to try my best to make simple polygon graphics do the job. They seem to hold their line widths better when stretched or compressed.
Craig
Re: Need clean image
Posted: Wed May 18, 2022 3:01 pm
by dunbarx
@LCMark.
Changing a polygon to a curve and setting its opaque works just fine. I do not need to revert back to a polygon. The shape stays stable when its dimensions are changed.
Craig