javascript - d3.event.translate contains NaN on zoom for touch devices -
i wrote custom zoom function svg using d3 so:
//zoom behavior function myzoom() { xpos = d3.event.translate[0]; ypos = d3.event.translate[1]; vis.attr("transform", "translate(" + d3.event.translate + ") scale(" + d3.event.scale + ")"); }
this works fine on non-touch devices, when zoom in on touch devices d3.event.translate array starts containing nan's. when occurs subsequent calls myzoom have issue , zooming stops working.
this error receive is:
error: invalid value <g> attribute transform="translate(nan,nan) scale(0.8467453123625244)" d3.v2.js?body=1:387 attrconstant d3.v2.js?body=1:387(anonymous function) d3.v2.js?body=1:3860 d3_selection_each d3.v2.js?body=1:509 d3_selectionprototype.each d3.v2.js?body=1:3859 d3_selectionprototype.attr d3.v2.js?body=1:3638 myzoom fw_tree.js?body=1:2842 event d3.v2.js?body=1:64 (anonymous function) d3.v2.js?body=1:175 dispatch d3.v2.js?body=1:4826 mousewheel d3.v2.js?body=1:4855 wrapper d3.v2.js?body=1:492
any or pointers appreciated
Comments
Post a Comment