Skip to content

Commit c44161f

Browse files
committed
better support for points
1 parent a7c23e0 commit c44161f

File tree

1 file changed

+3
-27
lines changed
  • imagetagger/imagetagger/annotations/static/annotations/js

1 file changed

+3
-27
lines changed

imagetagger/imagetagger/annotations/static/annotations/js/canvas.js

+3-27
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,9 @@ class Drawing {
180180
}
181181
}
182182

183-
class Point {
183+
class Point extends Drawing {
184184
constructor(parent, point, id, mutable, color) {
185-
/* Set fields */
186-
this.pointCounter = 1; // The number of points that are currently set
187-
this.id = id;
188-
this.name = "drawing" + id;
189-
this.parent = parent;
190-
this.mutable = mutable;
191-
this.color = color || globals.stdColor;
192-
185+
super(parent, point, id, mutable, color);
193186
/* Define layer */
194187
let l = {
195188
name: this.name,
@@ -198,28 +191,11 @@ class Point {
198191
x: point.x1, y: point.y1,
199192
fillStyle: this.color,
200193
};
201-
this.parent.addLayer(l);
194+
this.parent.setLayer(l);
202195
this.parent.inline = false;
203196
this.parent.locked = false;
204197
this.parent.updateAnnotationFields(point);
205198
}
206-
/** Set the cursor to 'drag' or 'crosshair' in mouseover
207-
*
208-
* @param bool whether the dursor is in 'drag' style
209-
*/
210-
setDragCursor(bool) {}
211-
setMutable(mutable) {}
212-
getPointTuples() {
213-
let l = this.parent.getLayer(this.name);
214-
return [[l.x, l.y]];
215-
}
216-
getPoints() {
217-
let l = this.parent.getLayer(this.name);
218-
return {x1: l.x, y1: l.y};
219-
}
220-
remove() {
221-
this.parent.removeLayer(this.name);
222-
}
223199
}
224200

225201
class Line extends Drawing {

0 commit comments

Comments
 (0)