/** * @file ext-shapes.js * * @license MIT * * @copyright 2010 Christian Tzurcanu, 2010 Alexis Deveria * */ var e={name:"shapes",init:function init(e){e.$;var t,a,n,s=this.canvas,o=s.getRootElem(),r={},i="shapelib",l={};return{events:{id:"tool_shapelib",click:function click(){s.setMode(i)}},callback:function callback(){},mouseDown:function mouseDown(e){if(s.getMode()===i){var o=document.getElementById("tool_shapelib").dataset.draw,c=a=e.start_x,m=n=e.start_y,u=s.getStyle();return l.x=e.event.clientX,l.y=e.event.clientY,(t=s.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:o,id:s.getNextId(),opacity:u.opacity/2,style:"pointer-events:none"}})).setAttribute("transform","translate("+c+","+m+") scale(0.005) translate("+-c+","+-m+")"),s.recalculateDimensions(t),s.getTransformList(t),r=t.getBBox(),{started:!0}}},mouseMove:function mouseMove(e){if(s.getMode()===i){var l=s.getZoom(),c=e.event,m=e.mouse_x/l,u=e.mouse_y/l,d=s.getTransformList(t),h=t.getBBox(),f=h.x,p=h.y,v=(Math.min(a,m),Math.min(n,u),Math.abs(m-a)),g=Math.abs(u-n),M=v/r.width||1,y=g/r.height||1,b=0;m