以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 SVG/GML/VRML/X3D/XAML 』 (http://bbs.xml.org.cn/list.asp?boardid=21) ---- Batik中多个SVG元素拖动问题,如何处理闪烁现象? (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=70664) |
-- 作者:pisces_mary -- 发布时间:12/19/2008 8:59:00 AM -- Batik中多个SVG元素拖动问题,如何处理闪烁现象? 我用数组记录被点击的SVG数组,在拖动过程中不像单个元素拖动那样自然,会出现闪烁现象,请问又没有人知道如何刷新处理?还有就是在拖动过程中总是出现java.lang.IllegalStateException或者java.lang.NullPointerException 的错误,这个该如何解决?我在拖动过程中使用了数组,应该是数组中有空值,但是有时有,有时没有,请问这该如何处理? 出现空值得错误提示如下: java.lang.NullPointerException at org.apache.batik.bridge.PaintServer.convertStroke(PaintServer.java:465) at org.apache.batik.bridge.PaintServer.convertFillAndStroke(PaintServer.java:150) at org.apache.batik.bridge.SVGShapeElementBridge.createShapePainter(SVGShapeElementBridge.java:117) at org.apache.batik.bridge.SVGRectElementBridge.createShapePainter(SVGRectElementBridge.java:153) at org.apache.batik.bridge.SVGShapeElementBridge.buildGraphicsNode(SVGShapeElementBridge.java:91) at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:145) at org.apache.batik.bridge.SVGGElementBridge.handleElementAdded(SVGGElementBridge.java:123) at org.apache.batik.bridge.SVGGElementBridge.handleDOMNodeInsertedEvent(SVGGElementBridge.java:107) at org.apache.batik.bridge.BridgeContext$DOMNodeInsertedEventListener.handleEvent(BridgeContext.java:1601) at org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:324) at org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:366) at org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:258) at org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:1014) at org.apache.batik.dom.AbstractParentNode.fireDOMNodeInsertedEvent(AbstractParentNode.java:422) at org.apache.batik.dom.AbstractParentNode.appendChild(AbstractParentNode.java:224) at SVGTest.DrawRectangle(SVGTest.java:1007) at SVGTest.mouseReleased(SVGTest.java:686) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) |
-- 作者:pisces_mary -- 发布时间:12/20/2008 12:37:00 PM -- 这个问题解决了,对组元素设置transform属性就可以了 |
-- 作者:pisces_mary -- 发布时间:12/21/2008 2:33:00 PM -- 给出我的实现方法,给大家参考,对要移动的每一个元素添加到一个临时的g组元素中,然后对这个g元素的transform属性设置translaet,移动完成后设置每一个要移动元素的坐标,并把要移动的元素重新写回到SVG画布中去,删除临时添加的g组元素,用数组循环设置要移动的每一格元素的坐标也可以实现,不过会出现闪烁现象 |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
62.500ms |