svg.draw.js icon indicating copy to clipboard operation
svg.draw.js copied to clipboard

draw element and then zoom can't in right position

Open SunnyXJ opened this issue 7 years ago • 2 comments

now I use svg.draw.js and svg.panzoom.js draw something, but I found when i draw and zoom the position isn't right. I add mousewheel fun and resolve this problem ,code like that: if(e.type=='mousewheel'){ this.m=this.el.node.getScreenCTM().inverse(); }

SunnyXJ avatar Nov 23 '18 07:11 SunnyXJ

`calc:function (e) { var arr = this.el.array().valueOf(); arr.pop();

        if (e) {
			if(e.type=='mousewheel'){  // get new m for transformPoint
				this.m=this.el.node.getScreenCTM().inverse();
			}
            var p = this.transformPoint(e.clientX, e.clientY);
            arr.push(this.snapToGrid([p.x, p.y]));
        }

        this.el.plot(arr);
        this.drawCircles();
    },`

SunnyXJ avatar Nov 23 '18 07:11 SunnyXJ

@SunnyXJ Your fix works, however, I can't reproduce the issue anymore when using the latest source from this repository.

It seems like the published npm version (2.0.4) is out of date and needs a bump.

bnjm avatar Dec 21 '18 14:12 bnjm