From 18c2b1b16d28597e52a1f41935425c8a0a0bd28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Sun, 10 Jul 2022 12:51:19 +0200 Subject: [PATCH] Fix Globe appearing when changing page?! Apparently the globe was running too early and would not show up from a page to another Waiting for the page transition is helping Thanks Baptiste! --- .../organisms/InteractiveGlobe.svelte | 38 +++++++++++-------- src/modules/globe/index.js | 1 + src/style/modules/_globe.scss | 10 +++++ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/components/organisms/InteractiveGlobe.svelte b/src/components/organisms/InteractiveGlobe.svelte index e69c045..bc017f1 100644 --- a/src/components/organisms/InteractiveGlobe.svelte +++ b/src/components/organisms/InteractiveGlobe.svelte @@ -3,7 +3,7 @@ diff --git a/src/modules/globe/index.js b/src/modules/globe/index.js index 39dac6f..c76527e 100644 --- a/src/modules/globe/index.js +++ b/src/modules/globe/index.js @@ -81,6 +81,7 @@ class WebglGlobe { // we put the canvas at the end of body tag as 'position:fixed' // this is to avoid having a too big canvas if the globe needs to be very large: // so instead we move the globe as we scroll + this.renderer.canvas.classList.add('globe-canvas') this.renderer.canvas.style.position = 'fixed' this.renderer.canvas.style.top = 0 this.renderer.canvas.style.left = 0 diff --git a/src/style/modules/_globe.scss b/src/style/modules/_globe.scss index 74553c8..2b80636 100644 --- a/src/style/modules/_globe.scss +++ b/src/style/modules/_globe.scss @@ -51,6 +51,16 @@ } } +// Canvas +:global(.globe-canvas) { + transition: opacity 0.2s var(--ease-quart); + + // Hidden state + &:global(.is-hidden) { + opacity: 0; + transform: translate3d(0, 24px, 0); + } +} /* ** Markers