mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +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
|
// https://github.com/Azgaar/Fantasy-Map-Generator
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
const version = "1.661"; // generator version
|
const version = "1.662"; // generator version
|
||||||
document.title += " v" + version;
|
document.title += " v" + version;
|
||||||
|
|
||||||
// Switches to disable/enable logging features
|
// Switches to disable/enable logging features
|
||||||
|
|
@ -493,15 +493,12 @@ function invokeActiveZooming() {
|
||||||
// rescale map markers
|
// rescale map markers
|
||||||
if (+markers.attr("rescale") && markers.style("display") !== "none") {
|
if (+markers.attr("rescale") && markers.style("display") !== "none") {
|
||||||
markers.selectAll("use").each(function () {
|
markers.selectAll("use").each(function () {
|
||||||
const x = +this.dataset.x,
|
const {x, y, size} = this.dataset;
|
||||||
y = +this.dataset.y,
|
const actualSize = Math.max(rn(size * 5 + 25 / scale, 2), 1);
|
||||||
desired = +this.dataset.size;
|
const actualX = rn(Number(x) - actualSize / 2, 2);
|
||||||
const size = Math.max(desired * 5 + 25 / scale, 1);
|
const actualY = rn(Number(y) - actualSize, 2);
|
||||||
d3.select(this)
|
|
||||||
.attr("x", x - size / 2)
|
d3.select(this).attr("x", actualX).attr("y", actualY).attr("width", actualSize).attr("height", actualSize);
|
||||||
.attr("y", y - size)
|
|
||||||
.attr("width", size)
|
|
||||||
.attr("height", size);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue