PolygonMorph balloon text

Peace Jerome peace_the_dreamer at yahoo.com
Wed Jan 12 03:45:05 UTC 2005


Frank wrote:


>I'm writing an NCSA image map editor.
>I've got an ImageMorph holding the
>image, and to it I add Morphs for each
>entry in the map file. Thus when you're
>editing the map you see polygons,
>rectangles, circles overlaid on the
>image. All nice and neat.
>
>So I realised that you will want to
>know what region points to what URL, so
>I thought I'd use a balloon text. It was
>trivial to do this for EllipseMorphs and
>BorderedMorphs (for the circle & rect
>entries, respectively, of course). But
>I found that my polygonal regions don't
>work quite as nicely. Each ImageMapEntry
>has an #asMorph, and
>ImageMapPolygonEntry>>asMorph looks
>like this:
>
>asMorph
>| p |
>p := PolygonMorph
>vertices: self points
>color: Color transparent
>borderWidth: 1
>borderColor: Color black.
>p setBalloonText: self targetUri
>asString.
>^ p.
>
>When I hover the mouse within the
>region though I don't see the balloon
>text. It's only when I hover the mouse
>over the lines in the polygon (the
>borders of the region, if you like)
>that I see the balloon text.
>
>Thus my question: How can I have the
>balloon text show up when the mouse
>hovers anywhere within the bounds of
>the polygon?
>
>I've tried searching, and got as far as
>Morph>>handleMouseEnter: which calls
>HandMorph>>triggerBalloonFor:after - I
>thought perhaps PolygonMorph overrode
>something to make mouse hover balloon
>texts behave the way they do, but I
>couldn't find anything.
>
>frank

The key here is the transparency of the polygon. Try
using a translucent one instead. (White at 5%
translucency is pretty close to transparent.). I just
tried this in 3.9-6542 and had no problem getting the
balloons. 

The polygon keeps track of its holes and where it is
transparent it is not there for the mouse/hand to see.
This may be a bug but it probably won't be an easy one
to fix.  So I suggest the work around.

Yours in service, --Jerome Peace


		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 




More information about the Squeak-dev mailing list