Skip to content

Commit

Permalink
Scaling keypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Feb 24, 2019
1 parent ed19e82 commit 74d1ad7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
12 changes: 10 additions & 2 deletions client/src/components/annotator/Annotation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ export default {
// Create new compoundpath
this.compoundPath = new paper.CompoundPath();
this.compoundPath.onDoubleClick = event => {
this.compoundPath.onDoubleClick = () => {
if (this.activeTool !== "Select") return;
$(`#annotationSettings${this.annotation.id}`).modal("show");
}
};
this.keypoints = new Keypoints(this.keypointEdges);
let keypoints = this.annotation.keypoints;
Expand Down Expand Up @@ -659,6 +659,14 @@ export default {
},
keypointEdges(newEdges) {
newEdges.forEach(e => this.keypoints.addEdge(e));
},
scale: {
immediate: true,
handler(scale) {
if (!this.keypoints) return;
this.keypoints.radius = scale * 6;
this.keypoints.lineWidth = scale * 2;
}
}
},
computed: {
Expand Down
1 change: 1 addition & 0 deletions client/src/components/annotator/Category.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
ref="annotation"
:hover="hover.annotation"
:active-tool="activeTool"
:scale="scale"
@deleted="annotationDeleted"
/>

Expand Down
8 changes: 4 additions & 4 deletions client/src/libs/keypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ export class Keypoint extends paper.Point {
}

_draw() {
let storkeWidth = 1;
let strokeColor = this.color;
if (this.path !== null) {
storkeWidth = this.path.strokeWidth;
strokeColor = this.path.strokeColor;
this.path.remove();
}

Expand All @@ -369,8 +369,8 @@ export class Keypoint extends paper.Point {
this.path.onClick = this.onClick;

this.path.indicator = true;
this.path.strokeColor = this.color;
this.path.strokeWidth = storkeWidth;
this.path.strokeColor = strokeColor;
this.path.strokeWidth = this.radius * 0.4;
this.path.visible = this.visible;
this.path.keypoint = this;
this.path.keypoints = this.keypoints;
Expand Down
1 change: 1 addition & 0 deletions client/src/views/Annotator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
@click="onCategoryClick"
:current="current"
:active-tool="activeTool"
:scale="image.scale"
ref="category"
/>
</div>
Expand Down

0 comments on commit 74d1ad7

Please sign in to comment.