Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
scalable hotspots medialesson textplus
  • Loading branch information
NSavenije committed Apr 19, 2021
1 parent dd6dc91 commit 1dc3078
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 103 deletions.
Expand Up @@ -30,7 +30,7 @@ optional: end position* line
Popcorn.plugin("textplus", function(options) {

// define plugin wide variables / functions here
var $target;
var $target, $showHs, $showLbl;

return {
_setup: function(options) {
Expand All @@ -53,11 +53,11 @@ optional: end position* line
var size = options.attrib.hsSize;
$showHs = $('<div class="Hs x_noLightBox showHotspot"/>').addClass(options.attrib.icon).appendTo($showHolder);
$showHs.css({
"height" : size * 0.8,
"width" : size * 0.8,
"padding" : size * 0.1,
"height" : size * 0.8,
"width" : size * 0.8,
"padding" : size * 0.1,
"border-radius" : size / 2 + 1,
"font-size" : size * 0.8,
"font-size" : size * 0.8,
"background-color": options.attrib.colour1,
"color": options.attrib.colour2,
}).data({
Expand All @@ -79,7 +79,7 @@ optional: end position* line
})
});

var $showLbl = $("<div class='showLabel panel'>" + options.name + "</div>");
$showLbl = $("<div class='showLabel panel'>" + options.name + "</div>");
if(options.attrib.tooltip == "label") {

$showLbl.appendTo($showHolder);
Expand Down Expand Up @@ -133,6 +133,41 @@ optional: end position* line
$target.parent().addClass("qWindow");
}
else {
var hh = $(".mainMedia").height();
var size = options.attrib.hsSize;
$showHs.css({
"height" : (size * 0.008) * hh + "px",
"width" : (size * 0.008) * hh + "px",
"padding" : (size * 0.001) * hh + "px",
"border-radius" : (size / 2 + 1) * 0.01 * hh + "px",
"font-size" : (size * 0.008) * hh + "px",
});
if(options.attrib.tooltip == "label") {
// Cap the fontsize to reasonable values
var fs = size * 0.4 <= 12 ? 12 : size * 0.4 > 32 ? 32 : size * 0.4;
$showLbl.css({
"padding": 5,
"padding-left": (size * 0.55) * 0.01 * hh + 5,
"left": (size * 0.005) * hh,
"top": (size * 0.005) * hh,
"font-size": fs
});
}
else if(options.attrib.tooltip == "tooltip"){
$showHs.hover(function(){
$showLbl.css({
"left": $showLbl.outerWidth() * -0.5 + (size * 0.005 * hh),
"top" : $showLbl.outerHeight() * -1,
'box-shadow': 'none',
"overflow" : 'hidden'
}).show();
}, function() {
$showLbl.css({
'box-shadow': 'none',
'z-index': 1
}).hide();
});
}
$target.parent().css({
"padding": 0
})
Expand Down

0 comments on commit 1dc3078

Please sign in to comment.