A modest proposal for a new property

hh hh at hyperhh.de
Wed Sep 27 00:14:27 EDT 2017


> Richard Gaskin wrote:

> > Mark Wieder wrote:
> > That's the point where I stopped trying to do pie charts in LiveCode.
> > Worse: try to set a tooltip showing the percentage under the cursor.
> 
> Multiple graphic objects?

Sadly no. This simply doubles the problem.
The pie chart was the cause I made the mentioned "pointInShape"-stack.
There it is done by computing a math relation for the arc, but would be
easier to see by a points-path, that describeds the outline of the pie.

> Jacqueline LG wrote:
> The original issue that influenced this one was how to provide a larger
> hit zone on an SVG widget. How would this property work for that?

[1] Active from widget:
Enlarge the size of the widget by transparent parts to the wanted hitZone
and react on a hitMessage from the widget which sends to its parent, for
example, "clickedInHitzone clickLoc, otherProps".
Here hitZone is a settable polygonial property, given as path or points,
as QL suggested. (For example you could set the hitzone of a svg icon to
the path of a different svg icon, or build it from the points of a LCS
graphic object or any points list).

OR

[2] Passive from widget:
Make in LCS clickable transparent regions, layer them as you want and
identify (possibly disabled) widgets with it. Then send a hitMessage to
these (possibly disabled) objects. And do the hard job of mixing native
and non-native layers by yourself.

*** Currently, in both cases the hitMessage has to be implemented by
the author of the widget, as sender or as receiver. ***

I have it already *partially* done for case [1] with my (shared) widgets
SVG_Text and OrientedText. There you can react or not on a click on
*transparent* parts of the widget. This would be doable with the same
technique for a big class of polygonial regions -- just as Quentin proposed.

Easy future for part [2]: The public handlers of a widget become really
"public" -- I hope someone of the LC-team comes in to at least that point.
Currently they can (easily) be made public only by the author of the widget.

What you can't currently have is something in LCS that can act on widgets
with a method that is not implememented in the widget. That would be doable
but, TMHO, would be against the 'nature' of LCB-widgets. I would immediately
stop making widgets then.

This is my clear opinion, may sound hard:
If someone wants LCB to imitate features of certain (formatting-)languages
like CSS, then he/she should better do that in that (formatting-)language,
it is easy enough. And not try to make LCB slower by requesting to organize
his/her (possibly chaotic) layout.

OR

[3] The simplest way:
Write your own (upgraded) widget. Then you can have your own hitZones,
may even be of size zero or covering the display of all possibly connected
devices. And you can even hide the widget's rectangular "overflow" by using
"clip to <mRect> on <mCanvas>".




More information about the Use-livecode mailing list