Skip to content

Commit

Permalink
Fix red dot position for labels when moving them
Browse files Browse the repository at this point in the history
  • Loading branch information
mthh committed May 12, 2023
1 parent 4f7bfe7 commit 717bd61
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes
=======

0.16.2 (2023-05-12)
-------------------

- Fix red dot position for labels when moving them.

0.16.1 (2023-05-11)
-------------------

Expand Down
15 changes: 14 additions & 1 deletion client/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,20 @@ export const drag_label = d3.drag()
event.sourceEvent.preventDefault();
handle_click_hand('lock');
// Display a red square to indicate the original position of the label
drag_start_ref_position.call(this, event);
const zoom = svg_map.__zoom;
const centroid = proj([this.__data__.properties.x, this.__data__.properties.y]);
centroid[0] = centroid[0] * zoom.k + zoom.x;
centroid[1] = centroid[1] * zoom.k + zoom.y;
map.append('rect')
.attrs({
x: centroid[0] - 2,
y: centroid[1] - 2,
height: 4,
width: 4,
id: 'ref_symbol_location',
})
.style('fill', 'red');

})
.on('end', function (event) {
if (event.subject && !event.subject.map_locked) { handle_click_hand('unlock'); }
Expand Down
4 changes: 4 additions & 0 deletions documentation/src/changelog_fr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Historique des versions et des changements effectués

#### 0.16.2 (2023-05-12)

- Corrige la position des points rouges indiquant la position d'origine du label lors du déplacement d'un label.

#### 0.16.1 (2023-05-11)

- Amélioration de la compatibilité entre la nouvelle gestion et l'ancienne gestion de la position des labels déplacés manuellement lors du chargement d'un fichier de projet créé avec une version antérieure à 0.16.0.
Expand Down

0 comments on commit 717bd61

Please sign in to comment.