Viewpoint Forums
Viewpoint Forums
Viewpoint Media Player Support
SVG Shape Mouse Events in V3.15|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Junior Member |
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.--> < !--The onclick declaration in the SVG Document calls this action from the MTX code. --> MTSJavaScript Func="alert(myVar)" /> |
||
|
|
Member |
Hi tonysoft,
Here is an example: http://3w3d.com/vet/SVG_clickable/ and the source: http://3w3d.com/vet/SVG_clickable.zip HTH, Daimen |
|||
|
|
Junior Member |
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 |
|||
|
|
Member |
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> |
|||
|
|
Junior Member |
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.--> < !--The onclick declaration in the SVG Document calls this action from the MTX code. --> MTSJavaScript Func="alert(myVar)" /> |
|||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|
Viewpoint Forums
Viewpoint Forums
Viewpoint Media Player Support
SVG Shape Mouse Events in V3.15
