Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint Media Player Support    SVG Shape Mouse Events in V3.15

Moderators: e_phoenix13
Go
New
Find
Notify
Tools
Reply
  
5-star Rating (2 Votes) Rate It!  Login/Join 
Junior Member
Posted
The Doc implies that as of V3.14 you could handle mouse events for individual shapes within an SVG texture.

The sample code looks like the below segment and I've fixed the XML errors in it and tried every permutation in a sample MTX. Do you have a working sample of this functionality?

Thanks,
tonysoft

Here is your snippet:
< !-- Here, when the user clicks on the circle object, the onclick calls the MTSAction java_script function below.-->


fill="red"
onclick="func(myVar="11")"/>



< !--The onclick declaration in the SVG Document calls this action from the MTX code. -->


MTSJavaScript Func="alert(myVar)" />
 
Posts: 3 | Location: Concord, NH, USA | Registered: October 22, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of duncan
Posted Hide Post
Hi tonysoft,

Here is an example:

http://3w3d.com/vet/SVG_clickable/

and the source:

http://3w3d.com/vet/SVG_clickable.zip

HTH,
Daimen
 
Posts: 381 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
Junior Member
Posted Hide Post
Thanks Daimen...

This helped a lot. Turns out I had everthing right except that, unlike your sample, I'm using the SVG as a texture. Everything displays fine and I get the events handled, but the hit testing on the shapes is way off.

Give me your EMail and I'll send you a Zip which is a variation of Viewpoint's SVG Sample. Or, if you are familiar with the sample, simply take that sample, add the MTSActions and lay your SVG inside the Display Screen instead of the Time Tunnel SVG file. You'll see the problem.

Thanks again,
Tony
 
Posts: 3 | Location: Concord, NH, USA | Registered: October 22, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of duncan
Posted Hide Post
So what you were experiencing is this: Even though the SVG texture was applied to the LCD screen, it's clickable areas are still of the window coordinates (as if there was an invisible copy of the SVG applied to the PostAnimator). You'll notice the same behavior applying zoomview or flash as a texture on geometry as well. You need to map the Texture Coodinates to the UV coordinate for the clickable areas to respond accurately, like so:

<MTSAction Name="swapCoords">
<MTSCopyProperty Src="MTSEvent.TxtCoords.x" Dest="MTSEvent.ucrd"/>
<MTSCopyProperty Src="MTSEvent.TxtCoords.y" Dest="MTSEvent.vcrd"/>
<intro/>
</MTSAction>
<MTSInteractor>
<MTSHandle Event="MouseLeftClick" Action="swapCoords"/>
<MTSHandle Event="MouseMove" Action="swapCoords"/>
</MTSInteractor>
 
 
Posts: 381 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
Junior Member
Posted Hide Post
One last follow up...

The Doc implies that you can pass custom Parameters and also access the Standard ID, Object, and Point Parameters in the Mouse Events.

The sample below must be missing some similar tricks and were missing for the basic functionality we've already resolved. Here is the snippet from the Doc again. What is the trick to pass and get Params?

Snippet:
< !-- Here, when the user clicks on the circle object, the onclick calls the MTSAction java_script function below.-->


fill="red"
onclick="func(myVar="11")"/>



< !--The onclick declaration in the SVG Document calls this action from the MTX code. -->


MTSJavaScript Func="alert(myVar)" />
 
Posts: 3 | Location: Concord, NH, USA | Registered: October 22, 2003Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint Media Player Support    SVG Shape Mouse Events in V3.15