yeyicheng edited a comment on issue #5009: canvas经过css3旋转90deg之后,响应触摸点有问题 URL: https://github.com/apache/incubator-echarts/issues/5009#issuecomment-469567341 @cjzhang1230 是的,我把代码贴给你,你参考一下。 ``` function defaultGetZrXY(el, e, out) { // This well-known method below does not support css transform. var box = getBoundingClientRect(el); var canvas = e.target; var orient = (window && window.orientation !== undefined)? window.orientation: screen.orientation.angle; var portrait = orient == 0 || orient == 180; function rotate_by_origin(x, y, ox, oy, angle) { var o = []; rotate(o, [-(oy - y), -(ox - x), 0, 0], angle * Math.PI / 180); return [ox + o[1], oy + o[0]]; } try { if((forceLandscape && portrait) || (forcePortrait && !portrait)) { var origin = Math.min($("#main").width(), $("#main").height()) / 2; var angle = portrait? -90: 90; var new_out = rotate_by_origin(e.clientX-box.left, e.clientY-box.top, origin, origin, angle); out.zrX = new_out[0]; out.zrY = new_out[1]; } else { out.zrX = e.clientX - box.left; out.zrY = e.clientY - box.top; } } catch (e) { alert(e); } } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
