以文本方式查看主题

-  中文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=67342)


--  作者:hfutzhu
--  发布时间:9/17/2008 4:58:00 PM

--  svg移动

function Init()//图片加载时事件
{
   SVGDocument = evt.target.ownerDocument;
   SVGRoot = SVGDocument.documentElement;
   orig_x = SVGRoot.currentTranslate.x;
   orig_y = SVGRoot.currentTranslate.y;
   orig_scale = SVGRoot.currentScale;
   
}


function MouseDown(evt)//鼠标点击事件
{
    cx=evt.clientX;
    cy=evt.clientY;
    IsMove=true;
}

function MouseMove(evt)//鼠标移动事件
{
  if (IsMove){
    var xx = evt.clientX;
    var yy = evt.clientY;
    if ((cx == null) || (cy == null))
    {
         cx = xx;
  cy = yy;
  return;
        
    }
    SVGRoot.currentTranslate.x = SVGRoot.currentTranslate.x + xx-cx ;
    SVGRoot.currentTranslate.y = SVGRoot.currentTranslate.y + yy-cy ;
    cx=xx;
    cy=yy;
   }

}

function MouseUp(evt)//鼠标松开
{
    IsMove=false;
}


拖动svg图片,.svg格式的打开后感觉拖动不是很好,在html里还好!哪位兄弟帮忙看看!谢谢,见附件!


--  作者:hfutzhu
--  发布时间:9/18/2008 9:50:00 AM

--  
没人回答?
--  作者:hfutzhu
--  发布时间:9/18/2008 5:27:00 PM

--  
没人说个为什么??
--  作者:deng0685
--  发布时间:11/29/2010 9:02:00 PM

--  
谢谢,太感谢了,找了我一个礼拜
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
3,324.219ms