W3C home > Mailing lists > Public > www-svg@w3.org > October 2007

Re: MouseClick: Limiting polyline area to line only

From: Doug Schepers <schepers@w3.org>
Date: Mon, 29 Oct 2007 17:16:37 -0400
Message-ID: <47264DB5.90500@w3.org>
To: "Eckert, Johannes" <johannes.eckert.ext@siemens.com>
Cc: www-svg@w3.org

Hi, Johannes-

If I understand you correctly, you want to have hit testing on pointer 
events for the stroke, but not for the fill.  If that's right, you can 
do this using the 'pointer-events' attribute or property.

Here's an example:

<svg version='1.1' xmlns='http://www.w3.org/2000/svg' 
xmlns:xlink='http://www.w3.org/1999/xlink' width='100%' height='100%' 
viewBox='55 95 65 65'>

    <polyline points='72.75,100 100.25,100 112.75,122.75 100.25,145.5 
72.75,145.5 60.25,122.75' fill='lime' stroke='orange' stroke-width='5' 
stroke-linecap='round' stroke-linejoin='round' pointer-events='stroke' 
onclick='alert("hit stroke")'/>

</svg>


By the way, this list, www-svg, is an W3C forum to discuss issues with the
SVG Spec. For questions about development details and such, you should post
to the very active,  friendly, and helpful list called SVG-Developers:
http://groups.yahoo.com/group/svg-developers/

Hope that helps-
-Doug Schepers
W3C Staff Contact, SVG, CDF, and WebAPI


Eckert, Johannes wrote (on 10/29/2007 5:07 AM):
> Hey guys,
> 
> I'm searching for some help cause I don't know a solution. Thus I hope
> to find one here :-/
> 
> My problem: I'm using SVG graphics within my own C# application written
> under .NET. For this I also use a control called SVGViewControl from
> Mobiform (http://www.mobiform.com/products/svgviewplus/svgviewplus.htm).
> Up to now everything works fine.
> One of the advantages of the SVGViewControl is that it supports C# as
> script language within the graphics. So I used this and integrated a
> MouseClick event. Works also fine so far.
> But when I use polyline elements then it's like they are all
> intersecting. When clicking on empty space, a polyline element is
> returned. This doesn't make sense until the area of such a polyline
> element is defined by the points as a rectangle not only the line
> itself.
> 
> Is there any attribute I can set for polyline elements to change this
> behaviour or what else to do? I'm really at a loss :(
> 
> Hope you all understand what I mean. My mother tongue is German so I may
> express some stuff differently than you guys from UK or US or whereever
> ;)
> Thanks for any help in advance!
> 
> 
> Best regards,
> 
> Johannes
> 
> 
> Here an example of my polyline elements:
>     <style type="text/css"><![CDATA[.HMIPolyLine {fill: none;
> stroke:black; stroke-width:1;stroke-dasharray:none
> ;stroke-dashoffset:none; stroke-linecap:butt}
> ]]></style>
>   <polyline points="1910 930, 1910 540, 4120 540, 4120 2850, 3390 2850,
> 3390 2750, " id="Polyline207" class="HMIPolyLine">
>     <metadata>
>       <cge:ObjectReference id="DomainObject"
> ObjectID="{513E2DE0-00D8-4071-AF5B-871870A317DF}"
> ClassID="{2513B4A6-1C64-11D4-81E3-00105A24673A}"
> ObjectName="ACLineSegment" ClassName="ACLineSegment" />
>     </metadata>
>   </polyline>
> 
> 
Received on Monday, 29 October 2007 21:16:46 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:37 GMT