Skip to content

Commit

Permalink
better support for points
Browse files Browse the repository at this point in the history
  • Loading branch information
timonegk committed Apr 6, 2021
1 parent a7c23e0 commit c44161f
Showing 1 changed file with 3 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,9 @@ class Drawing {
}
}

class Point {
class Point extends Drawing {
constructor(parent, point, id, mutable, color) {
/* Set fields */
this.pointCounter = 1; // The number of points that are currently set
this.id = id;
this.name = "drawing" + id;
this.parent = parent;
this.mutable = mutable;
this.color = color || globals.stdColor;

super(parent, point, id, mutable, color);
/* Define layer */
let l = {
name: this.name,
Expand All @@ -198,28 +191,11 @@ class Point {
x: point.x1, y: point.y1,
fillStyle: this.color,
};
this.parent.addLayer(l);
this.parent.setLayer(l);
this.parent.inline = false;
this.parent.locked = false;
this.parent.updateAnnotationFields(point);
}
/** Set the cursor to 'drag' or 'crosshair' in mouseover
*
* @param bool whether the dursor is in 'drag' style
*/
setDragCursor(bool) {}
setMutable(mutable) {}
getPointTuples() {
let l = this.parent.getLayer(this.name);
return [[l.x, l.y]];
}
getPoints() {
let l = this.parent.getLayer(this.name);
return {x1: l.x, y1: l.y};
}
remove() {
this.parent.removeLayer(this.name);
}
}

class Line extends Drawing {
Expand Down

0 comments on commit c44161f

Please sign in to comment.