Skip to content

Commit a195d19

Browse files
authored
Merge pull request #69 from ESA-EarthCODE/zoom-to-hover
Zoom to hover
2 parents 997be94 + 98a1a6e commit a195d19

File tree

1 file changed

+109
-5
lines changed

1 file changed

+109
-5
lines changed

pages/Getting started with EarthCODE/Deep Dive into EarthCODE.md

Lines changed: 109 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,127 @@ order: 4
33
---
44
# Deep Dive into EarthCODE
55

6+
7+
# Hey There
8+
9+
10+
611
:::tip This guide goes into detail about how EarthCODE works and how the different entities within it are related. For the purposes of browsing the catalog or publishing through any of the integrated platforms, you do not need to necesarily understand any of these details below. If however, you are publishing manually, are a platform provider trying to integrate, or otherwise interested in how EarthCODE works this guide will give you the necessary context and background.
712
:::
813

914
As described in [Step 1: Understand EarthCODE Terminology](/Getting%20started%20with%20EarthCODE/#step-1-understand-earthcode-terminology) EarthCODE provides an integrated ecosystem designed to support scientists through the full lifecycle of doing Open Science. EarthCODE was designed around supporting the work of scientists and developers from ESRIN, the ESA Science Clusters, the ESA Science Hub, and EC and ESA- Funded Activities.
1015

1116
A detailed concept of what EarthCODE is and the different actors involved can be seen in the figure below:
12-
17+
<!--
1318
:::tip note to self, which one is better?
1419
Need to make this bigger - and zoomable
1520
Can we make it clickable
16-
:::
21+
::: -->
1722
<!-- ![EarthCODE Concept](/img/terms/earthcode-concept.svg)
1823
1924
V2 -->
20-
21-
22-
![EarthCODE Concept](/img/terms/earthcode-conceptv2.svg)
25+
<!-- <div class="zoom-container">
26+
<img src="/img/terms/earthcode-conceptv2.svg" alt="Zoomed image" class="zoom-image" />
27+
</div>
28+
29+
<style>
30+
.zoom-container {
31+
width: fit-content;
32+
height: fit-content;
33+
overflow: hidden;
34+
position: relative;
35+
}
36+
37+
.zoom-image {
38+
width: 100%;
39+
height: auto;
40+
transition: transform 0.3s ease;
41+
transform-origin: center center;
42+
}
43+
44+
.zoom-container:hover .zoom-image {
45+
transform: scale(1.8);
46+
}
47+
48+
.zoom-container {
49+
--x: 50%;
50+
--y: 50%;
51+
}
52+
.zoom-container:hover .zoom-image {
53+
transform-origin: var(--x) var(--y);
54+
}
55+
56+
</style>
57+
<script setup>
58+
if (typeof window !== 'undefined') {
59+
document.addEventListener('mousemove', function (e) {
60+
document.querySelectorAll('.zoom-container').forEach(container => {
61+
const rect = container.getBoundingClientRect();
62+
const x = ((e.clientX - rect.left) / rect.width) * 100;
63+
const y = ((e.clientY - rect.top) / rect.height) * 100;
64+
container.style.setProperty('--x', `${x}%`);
65+
container.style.setProperty('--y', `${y}%`);
66+
});
67+
});
68+
}
69+
</script> -->
70+
71+
:::tip
72+
Hover to zoom
73+
:::
74+
<div class="zoom-wrapper">
75+
<div class="zoom-container">
76+
<img src="/img/terms/earthcode-conceptv2.svg" class="zoom-image" alt="Zoom preview" />
77+
</div>
78+
</div>
79+
80+
<style>
81+
.zoom-wrapper {
82+
position: relative;
83+
display: inline-block;
84+
padding: 20px; /* Sensitivity margin */
85+
--x: 50%;
86+
--y: 50%;
87+
cursor: zoom-in;
88+
89+
}
90+
.zoom-container {
91+
overflow: hidden;
92+
position: relative;
93+
width: fit-content;
94+
height: fit-content;
95+
cursor: zoom-in;
96+
}
97+
98+
.zoom-image {
99+
display: block;
100+
width: 100%;
101+
height: auto;
102+
transition: transform 0.3s ease;
103+
transform-origin: var(--x) var(--y);
104+
}
105+
106+
.zoom-wrapper:hover .zoom-image {
107+
transform: scale(1.8); /* zoom factor */
108+
}
109+
</style>
110+
<script setup>
111+
if (typeof window !== 'undefined') {
112+
document.addEventListener('mousemove', (e) => {
113+
document.querySelectorAll('.zoom-wrapper').forEach(wrapper => {
114+
const rect = wrapper.getBoundingClientRect();
115+
const x = ((e.clientX - rect.left) / rect.width) * 100;
116+
const y = ((e.clientY - rect.top) / rect.height) * 100;
117+
// zoom jumps handle/clamp
118+
if (x >= 0 && x <= 100 && y >= 0 && y <= 100) {
119+
wrapper.style.setProperty('--x', `${x}%`);
120+
wrapper.style.setProperty('--y', `${y}%`);
121+
}
122+
});
123+
});
124+
}
125+
126+
</script>
23127

24128

25129
In summary, EarthCODE provides the following:

0 commit comments

Comments
 (0)