mirror of
https://github.com/Mintplex-Labs/nut.js.git
synced 2026-07-21 01:15:22 -04:00
More renaming
This commit is contained in:
+3
-7
@@ -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
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user