From: Vincent Vanwaelscappel Date: Tue, 22 Jan 2019 15:50:34 +0000 (+0100) Subject: wip #2534 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=bd795ef902f25cadf6b4f5b8d9d39a557ca9901c;p=fluidbook-html5.git wip #2534 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.loader.js b/js/libs/fluidbook/fluidbook.loader.js index d664c156..159b8548 100644 --- a/js/libs/fluidbook/fluidbook.loader.js +++ b/js/libs/fluidbook/fluidbook.loader.js @@ -318,7 +318,7 @@ FluidbookLoader.prototype = { callback(); } else { var $this = this; - if (window.gal !== undefined && window.gal!==null && !OFFLINEAPP) { + if (window.gal !== undefined && window.gal !== null && !OFFLINEAPP) { window.gal.downloadAndCall('content_' + page, function () { $this.__loadBackground(page, callback); }, 250); @@ -370,6 +370,9 @@ FluidbookLoader.prototype = { var ctx = c.getContext("2d"); ctx.clearRect(0, 0, d, d); + var wr = d / $this.fluidbook.datas.width; + var hr = d / $this.fluidbook.datas.height; + // Draw background if (this.backgrounds[page] !== undefined && this.backgrounds[page] !== null) { ctx.drawImage(this.backgrounds[page].get(0), 0, 0, d, d); @@ -391,9 +394,29 @@ FluidbookLoader.prototype = { } } + // Draw content links + var clinks = this.fluidbook.datas.clinks[page]; + if (clinks !== '') { + $("body").append(''); + $("#texture_clinks .contentLink").each(function () { + var left = parseFloat($(this).css('left')) * wr; + var top = parseFloat($(this).css('top')) * hr; + var width = parseFloat($(this).css('width')) * wr; + var height = parseFloat($(this).css('height')) * hr; + if ($(this).is('[data-color]')) { + ctx.fillStyle = $(this).attr('data-color'); + ctx.fillRect(left, top, width, height); + } else { + + } + }); + + $("#texture_clinks").remove(); + } + // Draw the shadow if necessary if (this.fluidbook.datas.shadeAlpha > 0) { - var sw = 1024 * .25; + var sw = d * .25; var s, x; if (page % 2 === 0) { // Left