c# - Zoom in at touch point -
c# - Zoom in at touch point -
i have canvas 4048x8096, when seek zoom in, doesn't zoom in @ gesture point, moves towards point(0,0) canvas's position, here code i'm using: flickers when zoom limits reached.
private void graphsurface_manipulationdelta(object sender, system.windows.input.manipulationdeltaeventargs e) { var matrix = ((matrixtransform)this.rendertransform).matrix; point center = new point(this.actualwidth / 2, this.actualheight / 2); center = matrix.transform(center); if (scale <= zoominlimit && scale >= zoomoutlimit) { matrix.scaleat(e.deltamanipulation.scale.x, e.deltamanipulation.scale.y, center.x, center.y); } if (scale > zoominlimit) { matrix.m11 -= 0.001; matrix.m22 -= 0.001; } else if (scale < zoomoutlimit) { matrix.m11 = zoomoutlimit + 0.001; matrix.m22 = zoomoutlimit + 0.001; } ((matrixtransform)this.rendertransform).matrix = matrix; e.handled = true; }
here's demo zooms @ gesture point. utilize bottom example. code js, not java, should convert okay. replace awesome_tiger.svg canvas object. maybe give sample of need own code. hope helps.
http://timmywil.github.io/jquery.panzoom/demo/
c# wpf canvas matrix zoom
Comments
Post a Comment