More renaming

This commit is contained in:
Simon Hofmann
2018-09-04 09:37:22 +02:00
parent a01a625e9d
commit 1c320960e4
3 changed files with 14 additions and 18 deletions
+3 -7
View File
@@ -1,6 +1,6 @@
'use strict'
"use strict";
const point = require("./point");
const Point = require("./point");
class Mouse {
constructor(config) {
@@ -13,11 +13,7 @@ class Mouse {
}
setPosition(target) {
if (target instanceof point) {
this._native.setMousePosition(target.x(), target.y());
} else {
this._native.setMousePosition(target.x, target.y);
}
this._native.setMousePosition(target.x, target.y);
}
move(path) {
+7 -7
View File
@@ -1,6 +1,6 @@
'use strict'
const point = require("./point");
const Point = require("./point");
class Movement {
constructor(config) {
@@ -11,11 +11,11 @@ class Movement {
getPosition() {
const pos = this._native.currentMousePosition();
return new point(pos.x, pos.y);
return new Point(pos.x, pos.y);
}
straightTo(target) {
if (target instanceof point) {
if (target instanceof Point) {
const origin = this.getPosition();
return this._lineutil.straightLine(origin, target);
} else {
@@ -25,22 +25,22 @@ class Movement {
down(px) {
const pos = this.getPosition();
return this.straightTo(new point(pos.x(), pos.y() + px));
return this.straightTo(new Point(pos.x, pos.y + px));
}
up(px) {
const pos = this.getPosition();
return this.straightTo(new point(pos.x(), pos.y() - px));
return this.straightTo(new Point(pos.x, pos.y - px));
}
left(px) {
const pos = this.getPosition();
return this.straightTo(new point(pos.x() - px, pos.y()));
return this.straightTo(new Point(pos.x - px, pos.y));
}
right(px) {
const pos = this.getPosition();
return this.straightTo(new point(pos.x() + px, pos.y()));
return this.straightTo(new Point(pos.x + px, pos.y));
}
}
+4 -4
View File
@@ -1,6 +1,6 @@
'use strict'
const point = require("../point");
const Point = require("../point");
class LineHelper {
constructor() {
@@ -8,9 +8,9 @@ class LineHelper {
}
straightLine(from, to) {
if (from instanceof point) {
if (to instanceof point) {
return this._bresenham(from.x(), from.y(), to.x(), to.y());
if (from instanceof Point) {
if (to instanceof Point) {
return this._bresenham(from.x, from.y, to.x, to.y);
} else {
throw new TypeError("'to' is not a point.");
}