Code cleaned up

This commit is contained in:
Piotr Pekala 2019-03-29 03:32:12 -07:00
parent f29c705bba
commit 5558e17aaf

View File

@ -38,9 +38,8 @@ export class MovingModeComponent implements OnInit, OnDestroy {
this.mousemoveListener = (event: MouseEvent) => {
const view = select(this.svg);
const canvas = view.selectAll<SVGGElement, Context>('g.canvas').data([this.context]);
const canvasEnter = canvas.enter().append<SVGGElement>('g').attr('class', 'canvas');
canvas.merge(canvasEnter).attr('transform', () => {
canvas.attr('transform', () => {
this.context.transformation.x = this.context.transformation.x + event.movementX;
this.context.transformation.y = this.context.transformation.y + event.movementY;
@ -72,9 +71,8 @@ export class MovingModeComponent implements OnInit, OnDestroy {
const view = select(this.svg);
const canvas = view.selectAll<SVGGElement, Context>('g.canvas').data([this.context]);
const canvasEnter = canvas.enter().append<SVGGElement>('g').attr('class', 'canvas');
canvas.merge(canvasEnter).attr('transform', () => {
canvas.attr('transform', () => {
this.context.transformation.k = this.context.transformation.k - zoom/10;
const xTrans = this.context.getZeroZeroTransformationPoint().x + this.context.transformation.x;