Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Safari] Splash screen increases in scale slightly after loading has begun #407

Closed
phet-steele opened this issue Feb 24, 2017 · 12 comments
Closed
Labels

Comments

@phet-steele
Copy link

Blink and you'll miss it (actually the looping gif makes it very obvious, but it is very subtle otherwise):

splashscreen01

This is present on both mobile and desktop Safari. It happens every time I load the sim on macOS 10.12.3, but only happens once on the initial load for iOS 10.2 Safari. To make it happen again on mobile Safari, I can switch to and from another open tab, then reload the sim.

Tested with this link http://www.colorado.edu/physics/phet/dev/html/energy-skate-park-basics/1.3.1-dev.3/energy-skate-park-basics_en.html

@samreid
Copy link
Member

samreid commented Feb 24, 2017

I recommend to fix this not because it is a jarring visual issue but because it could indicate problems with how CSS is being dealt with in Joist, and could lead to problems in future browser versions (not just safari).

@samreid
Copy link
Member

samreid commented Mar 9, 2017

This is very subtle on my MBP, but I can see it.

@samreid
Copy link
Member

samreid commented Mar 9, 2017

To get to the same version of the code, I used dependencies.json and grunt --lint=false. I tried commenting out several CSS parts in joist, but the problem persists.

@samreid
Copy link
Member

samreid commented Mar 9, 2017

The problem is that the image changes size. On the first call, it is 273px wide then after load it is 274px wide.

Adding this code works around the problem:

  var splashImageWidth = 0;
  var splashImageHeight = 0;

  /**
   * Scale and position the given div, using the dimensions of the image for sizing.
   * @param {Element} div - the div to position
   * @param {HTMLImageElement} splashImg - the image to use for determining scale factor.  Not as exact as using the full
   *                                     - container div, but that dimension is not available on startup.
   */
  function positionDiv( div, splashImg ) {
    if ( splashImageWidth === 0 && splashImageHeight === 0 ) {
      splashImageWidth = splashImg.width;
      splashImageHeight = splashImg.height;
    }
    var currentWidth = splashImageWidth;
    var currentHeight = splashImageHeight;

@samreid
Copy link
Member

samreid commented Aug 9, 2017

Still seeing the problem in latest safari and merged with master.

@samreid
Copy link
Member

samreid commented Aug 9, 2017

I committed the workaround above and it still seems good for safari.

@samreid
Copy link
Member

samreid commented Aug 9, 2017

@samreid
Copy link
Member

samreid commented Aug 9, 2017

@jonathanolson suggested to check the naturalwidth

@samreid
Copy link
Member

samreid commented Aug 9, 2017

naturalWidth had the same problem as width, but @jonathanolson suggested to round out the image size by expanding the artboard then svg, and that seemed to fix the problem. Didn't fix IE though.

@samreid
Copy link
Member

samreid commented Aug 9, 2017

Fixed in the preceding commits, on hold until we work out IE in #408

@samreid
Copy link
Member

samreid commented Aug 12, 2017

This is out for testing in the aforementioned issue.

@phet-steele
Copy link
Author

I no longer see this on macOS 10.12.6, iOS 10.3 beta, or iOS 9.3.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants