From 1dc307880991862b82ca42c3f752d4e9d3ac120f Mon Sep 17 00:00:00 2001 From: NSavenije Date: Mon, 19 Apr 2021 23:56:12 +0200 Subject: [PATCH] scalable hotspots medialesson textplus --- .../js/popcorn/plugins/popcorn.textplus.js | 47 +++++- .../Nottingham/wizards/en-GB/data.xwd | 139 ++++++++++++------ src/Nottingham/wizards/en-GB/mediaLesson.xwd | 2 +- src/Nottingham/wizards/en-GB/template.xwd | 139 ++++++++++++------ 4 files changed, 224 insertions(+), 103 deletions(-) diff --git a/modules/xerte/parent_templates/Nottingham/common_html5/js/popcorn/plugins/popcorn.textplus.js b/modules/xerte/parent_templates/Nottingham/common_html5/js/popcorn/plugins/popcorn.textplus.js index 3b88af696b..9f7d6c7bb4 100644 --- a/modules/xerte/parent_templates/Nottingham/common_html5/js/popcorn/plugins/popcorn.textplus.js +++ b/modules/xerte/parent_templates/Nottingham/common_html5/js/popcorn/plugins/popcorn.textplus.js @@ -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) { @@ -53,11 +53,11 @@ optional: end position* line var size = options.attrib.hsSize; $showHs = $('
').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({ @@ -79,7 +79,7 @@ optional: end position* line }) }); - var $showLbl = $("
" + options.name + "
"); + $showLbl = $("
" + options.name + "
"); if(options.attrib.tooltip == "label") { $showLbl.appendTo($showHolder); @@ -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 }) diff --git a/modules/xerte/parent_templates/Nottingham/wizards/en-GB/data.xwd b/modules/xerte/parent_templates/Nottingham/wizards/en-GB/data.xwd index b5751104bd..cbaeee5783 100644 --- a/modules/xerte/parent_templates/Nottingham/wizards/en-GB/data.xwd +++ b/modules/xerte/parent_templates/Nottingham/wizards/en-GB/data.xwd @@ -4000,6 +4000,7 @@ ]]> + ]]> @@ -4072,8 +4073,8 @@ ]]> ]]> ]]> - ]]> - ]]> + ]]> + ]]> ]]> ]]> ]]> @@ -4086,18 +4087,34 @@ - ]]> - ]]> - ]]> - ]]> - ]]> - ]]> - ]]> - ]]> + ]]> + ]]> + ]]> + ]]> + ]]> + ]]> + ]]> + ]]> ]]> - + + + + + + ]]> + + ]]> + ]]> + ]]> + + + + @@ -4120,39 +4137,51 @@ - + - + - + + + + + + + + - - - - - + + + + - + - - - - - - + + + + + + + + + + + + - ]]> + ]]> @@ -4160,7 +4189,7 @@ - + @@ -4189,15 +4218,15 @@ - + - + - ]]> + ]]> ]]> ]]> @@ -4205,23 +4234,30 @@ + - + + - - + - - - - - + + + + + + + + + + - + + @@ -4255,10 +4291,10 @@ - + - + @@ -4272,10 +4308,17 @@ - + + + + + + + + - + @@ -4296,10 +4339,10 @@ - + - + @@ -4320,10 +4363,10 @@ - + - + + ]]> + ]]> + ]]> + + + + @@ -4120,39 +4137,51 @@ - + - + - + + + + + + + + - - - - - + + + + - + - - - - - - + + + + + + + + + + + + - ]]> + ]]> @@ -4160,7 +4189,7 @@ - + @@ -4189,15 +4218,15 @@ - + - + - ]]> + ]]> ]]> ]]> @@ -4205,23 +4234,30 @@ + - + + - - + - - - - - + + + + + + + + + + - + + @@ -4255,10 +4291,10 @@ - + - + @@ -4272,10 +4308,17 @@ - + + + + + + + + - + @@ -4296,10 +4339,10 @@ - + - + @@ -4320,10 +4363,10 @@ - + - +