Skip to content

Commit

Permalink
fix (image): exif map marker
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-kerjean committed Nov 5, 2024
1 parent f7988ff commit ded8ef2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions public/assets/pages/viewerpage/application_image_metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ async function componentMap(render, { metadata }) {
const TILE_SIZE = Math.floor($page.clientWidth / 3 * 100) / 100;
if (TILE_SIZE === 0) return;
$page.style.height = "${TILE_SIZE*3}px;";
const defaultTo = (val, def) => val === undefined ? val : def;
const mapper = (function map_url(lat, lng, zoom) {
// https://wiki.openstreetmap.org/wiki/Slippy_map_tilenamse
const n = Math.pow(2, zoom);
Expand All @@ -119,16 +118,13 @@ async function componentMap(render, { metadata }) {
.replace("${z}", Math.floor(zoom));
},
position: function() {
const t0 = defaultTo(tile_numbers[0], 0);
const t1 = defaultTo(tile_numbers[1], 0);
return [
t0 - Math.floor(t0),
t1 - Math.floor(t1),
tile_numbers[0] - Math.floor(tile_numbers[0]),
tile_numbers[1] - Math.floor(tile_numbers[1]),
];
},
};
}(lat, lng, 11));
const center = (position, i) => Math.floor(TILE_SIZE * (1 + position[i]) * 1000)/1000;
const $tiles = createElement(`
<div class="bigpicture">
<div class="line">
Expand All @@ -151,9 +147,10 @@ async function componentMap(render, { metadata }) {
qs($page, `[data-bind="maptile"]`).appendChild($tiles);
const pos = mapper.position();
qs($page, ".marker").setAttribute("style", `
left: ${TILE_SIZE * (1 + defaultTo(pos[0], 0)) - 15}px;
top: ${TILE_SIZE * (1 + defaultTo(pos[1], 0)) - 30}px;
left: ${TILE_SIZE * (1 + pos[0]) - 15}px;
top: ${TILE_SIZE * (1 + pos[1]) - 30}px;
`);
const center = (position, i) => Math.floor(TILE_SIZE * (1 + position[i]) * 1000)/1000;
$tiles.setAttribute("style", `transform-origin: ${center(mapper.position(), 0)}px ${center(mapper.position(), 1)}px;`);
}

Expand Down

0 comments on commit ded8ef2

Please sign in to comment.