以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  如何用滚轴实现svg图的缩放?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=28864)


--  作者:mxr
--  发布时间:3/19/2006 10:07:00 AM

--  如何用滚轴实现svg图的缩放?
我查了很多资料,发现用滚轴可以缩放html里面<img>的图片元素,却不能实现<embed>的svg图片,怎么办?有思路的请指点一下,谢谢!!!!!!!!!!!
--  作者:DragonJohn
--  发布时间:3/24/2006 2:57:00 PM

--  
熟悉SVG元素的viewBox属性。
--  作者:mxr
--  发布时间:4/30/2006 4:21:00 PM

--  
我早都实现了,哈哈

--  作者:jimnew88
--  发布时间:6/13/2006 10:00:00 PM

--  
怎么实现的啊,交流一下,我的QQ:是443991531
--  作者:mxr
--  发布时间:6/20/2006 3:41:00 PM

--  
我也早就实现了,现在把代码给大家共享一下。
function mousewheel()
{
   origscale=root.currentScale;
   origscale +=event.wheelDelta / 1200;
   if (origscale > 0)
   {
      root.currentScale=origscale;
      root.currentTranslate.x=midx*root.currentScale+event.offsetX*(1-root.currentScale/midscale);
   root.currentTranslate.y=midy*root.currentScale+event.offsetY*(1-root.currentScale/midscale);

      midscale=root.currentScale;
   midx=root.currentTranslate.x/root.currentScale;
   midy=root.currentTranslate.y/root.currentScale; 
   }
}


--  作者:upc2neiep
--  发布时间:12/29/2006 7:55:00 PM

--  
那你如何把滚轴事件添加都svg中?
是svgRoot.addEventListener("DOMMouseScroll",mousewheel,false);这个嘛?好像没有效果
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
62.500ms