diff options
| author | Eltrac <hi@guhub.cn> | 2025-09-16 15:19:11 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-09-16 15:19:11 +0800 |
| commit | 11e0bbedadcd950bb17bf4d97adfd0afb0bce713 (patch) | |
| tree | 9aca0b99595eeb8dc9b283ba0ef571eaf369de27 /src/shadow.js | |
| parent | f4f5d842dfb398e9da599fe2534167e95cc1d6b9 (diff) | |
refactor: move image handling to shadow class
- lightbox module no longer handles original image visibility
- lightbox module no longer handles shadow placement
- lightbox module now only fetch and use shadow object
Diffstat (limited to 'src/shadow.js')
| -rw-r--r-- | src/shadow.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/shadow.js b/src/shadow.js index 19703de..462b3af 100644 --- a/src/shadow.js +++ b/src/shadow.js @@ -11,6 +11,7 @@ export default class Shadow { */ constructor(image) { + this.original = image; this.create(image); this.startingState = { @@ -49,6 +50,10 @@ export default class Shadow { open() { this.isOpen = true; + + this.original.style.visibility = 'hidden'; + if (!document.body.contains(this.element)) this.placeItself(); + Animation.transformMatrix( this.element, this.startingState, @@ -58,6 +63,9 @@ export default class Shadow { close() { this.isOpen = false; + + this.original.style.visibility = 'visible'; + Animation.resetTransformMatrix(this.element); setTimeout(() => this.destroyItself(), 300); } |
