Skip to content

Commit

Permalink
Clean up polygon-overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
seieibob committed Mar 2, 2017
1 parent f33da0a commit d316c54
Showing 1 changed file with 31 additions and 39 deletions.
70 changes: 31 additions & 39 deletions modules/annotator/components/polygon-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,49 @@ class PolygonOverlay {
let polygons = annotations.map(annotation => JSON.parse(annotation.data["pointsArray"]));

//Sort polygon order by size (ascending)
// polygons.sort(function(a, b) {
// return this.GetArea(a) > this.GetArea(b);
// })
// polygons.sort(function(a, b) {
// return this.GetArea(a) > this.GetArea(b);
// })

for (let i = 0; i < polygons.length; i++) {
// Make a new child of polyParent and clip it

let $poly = $("<div class='annotator-overlay-poly'></div>").appendTo(this.$videoOverlay);
//$poly.addClass("annotator-poly");
$poly.clipPath(polygons[i], {
isPercentage: true,
svgDefId: 'annotatorPolySvg'
});

// Configure tooltip
// $poly.tooltipster({
// zIndex: this.baseZ + i,
// updateAnimation: null,
// animationDuration: 200,
// delay: 0,
// theme: 'tooltipster-borderless',
// plugins: ['follower']
// });
// $poly.tooltipster('content', annotations[i].data["text"]);


$poly.qtip({ // Grab all elements with a title attribute
content: {
text: annotations[i].data["text"]
},
position: {
my: 'bottom right', // Position my top left...
at: 'top left', // at the bottom right of...
target: 'mouse',
adjust: {
mouse: true
},
viewport: this.annotator.player.$container
},
hide: {
delay: 0 // No hide delay by default
},
style: {
classes: 'qtip-light qtip-rounded'
}
});

this.AddTooltip($poly, annotations[i]);

this.polyElements.push($poly);

}
}

AddTooltip($poly, annotation){
$poly.qtip({
content: {
title: annotation.metadata["id"],
text: annotation.data["text"]
},
position: {
my: 'bottom right',
at: 'top left',
target: 'mouse', // Follow the mouse
adjust: {
mouse: true,
method: "shift shift" // horizontal, vertical
},
viewport: this.annotator.player.$container
},
hide: {
delay: 0 // No hide delay by default
},
style: {
classes: 'qtip-light qtip-rounded'
}
});
}

Clear(){
// Clear all the polygons from the DOM
for(let i = 0; i < this.polyElements.length; i++){
Expand Down

0 comments on commit d316c54

Please sign in to comment.