Skip to content

Commit

Permalink
Chore: Position based on first annotation in thread (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodsum authored Feb 1, 2018
1 parent 77c26d7 commit 4035853
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Annotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,14 @@ class Annotator extends EventEmitter {
return;
}

// Bind events on valid annotation thread
const firstAnnotation = util.getLastAnnotation(annotations);
const thread = this.createAnnotationThread(annotations, firstAnnotation.location, firstAnnotation.type);
const controller = this.modeControllers[firstAnnotation.type];
// Register a valid annotation thread
// NOTE: The first annotation in the thread is used to determine the
// annotation (which shouldn't change regardless of what is specified
// in later annotations in that specific thread) whereas the last
// annotation is used to determine the type as specified above
const firstAnnotation = util.getFirstAnnotation(annotations);
const thread = this.createAnnotationThread(annotations, firstAnnotation.location, lastAnnotation.type);
const controller = this.modeControllers[lastAnnotation.type];
if (controller) {
controller.registerThread(thread);
}
Expand Down

0 comments on commit 4035853

Please sign in to comment.