Skip to main content
Participant
November 10, 2020
Question

Issues found in function makeResponsive

  • November 10, 2020
  • 1 reply
  • 1137 views

Hi,

 

the function makeResponsive have a problem, when i load two or more animations with different sizes in one page!

    an.makeResponsive = function(
        isResp,
        respDim,
        isScale,
        scaleType,
        domContainers
    ) {
        var lastW,
            lastH,
            lastS = 1;
        window.addEventListener("resize", resizeCanvas);
        resizeCanvas();
        function resizeCanvas() {
            var w = lib.properties.width, 
                h = lib.properties.height;
  [...]

 

var w = lib.properties.width,
h = lib.properties.height;

 

height and width will be overwritten from the last loaded animation-script!

the var "lib" must be passed here as a parameter in makeResponsitive.

    an.makeResponsive = function(
        *** lib, ***
        isResp,
        respDim,
        isScale,
        scaleType,
        domContainers
    ) {

 

And fix:

//Code to support hidpi screens and responsive scaling.
AdobeAn.makeResponsive(lib, true,'both',false,2,[canvas,anim_container,dom_overlay_container]);	

 

    This topic has been closed for replies.

    1 reply

    Participant
    May 7, 2024

    4 years later - thanks for that!