mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
markers - round coords on zoom
This commit is contained in:
parent
f5258f6ed0
commit
c8b7e9ccee
1 changed files with 7 additions and 10 deletions
17
main.js
17
main.js
|
|
@ -2,7 +2,7 @@
|
|||
// https://github.com/Azgaar/Fantasy-Map-Generator
|
||||
|
||||
"use strict";
|
||||
const version = "1.661"; // generator version
|
||||
const version = "1.662"; // generator version
|
||||
document.title += " v" + version;
|
||||
|
||||
// Switches to disable/enable logging features
|
||||
|
|
@ -493,15 +493,12 @@ function invokeActiveZooming() {
|
|||
// rescale map markers
|
||||
if (+markers.attr("rescale") && markers.style("display") !== "none") {
|
||||
markers.selectAll("use").each(function () {
|
||||
const x = +this.dataset.x,
|
||||
y = +this.dataset.y,
|
||||
desired = +this.dataset.size;
|
||||
const size = Math.max(desired * 5 + 25 / scale, 1);
|
||||
d3.select(this)
|
||||
.attr("x", x - size / 2)
|
||||
.attr("y", y - size)
|
||||
.attr("width", size)
|
||||
.attr("height", size);
|
||||
const {x, y, size} = this.dataset;
|
||||
const actualSize = Math.max(rn(size * 5 + 25 / scale, 2), 1);
|
||||
const actualX = rn(Number(x) - actualSize / 2, 2);
|
||||
const actualY = rn(Number(y) - actualSize, 2);
|
||||
|
||||
d3.select(this).attr("x", actualX).attr("y", actualY).attr("width", actualSize).attr("height", actualSize);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue