This commit is contained in:
Azgaar 2019-12-18 23:47:49 +03:00
parent 71d1e54dfc
commit c558029992
3 changed files with 11 additions and 3 deletions

View file

@ -10,7 +10,7 @@ function editBurg(id) {
burgLabels.selectAll("text").call(d3.drag().on("start", dragBurgLabel)).classed("draggable", true); burgLabels.selectAll("text").call(d3.drag().on("start", dragBurgLabel)).classed("draggable", true);
updateBurgValues(); updateBurgValues();
const my = id || d3.event.target.tagName === "text" ? "center bottom" : "center top+10"; const my = id || d3.event.target.tagName === "text" ? "center bottom-20" : "center top+20";
const at = id ? "center" : d3.event.target.tagName === "text" ? "top" : "bottom"; const at = id ? "center" : d3.event.target.tagName === "text" ? "top" : "bottom";
const of = id ? "svg" : d3.event.target; const of = id ? "svg" : d3.event.target;

View file

@ -10,10 +10,11 @@ function editRiver(id) {
viewbox.on("touchmove mousemove", showEditorTips); viewbox.on("touchmove mousemove", showEditorTips);
debug.append("g").attr("id", "controlPoints").attr("transform", elSelected.attr("transform")); debug.append("g").attr("id", "controlPoints").attr("transform", elSelected.attr("transform"));
drawControlPoints(node); drawControlPoints(node);
updateRiverName(node);
$("#riverEditor").dialog({ $("#riverEditor").dialog({
title: "Edit River", resizable: false, title: "Edit River", resizable: false,
position: {my: "center top+20", at: "top", of: node, collision: "fit"}, position: {my: "center top+80", at: "top", of: node, collision: "fit"},
close: closeRiverEditor close: closeRiverEditor
}); });
@ -44,6 +45,13 @@ function editRiver(id) {
if (d3.event.target.parentNode.id === "controlPoints") tip("Drag to move, click to delete the control point"); if (d3.event.target.parentNode.id === "controlPoints") tip("Drag to move, click to delete the control point");
} }
function updateRiverName(node) {
const river = +node.id.slice(5);
const r = pack.rivers.find(r => r.i === river);
riverName.value = r.name;
riverType.value = r.type;
}
function drawControlPoints(node) { function drawControlPoints(node) {
const l = node.getTotalLength() / 2; const l = node.getTotalLength() / 2;
const segments = Math.ceil(l / 8); const segments = Math.ceil(l / 8);

View file

@ -7,7 +7,7 @@ function editRoute(onClick) {
$("#routeEditor").dialog({ $("#routeEditor").dialog({
title: "Edit Route", resizable: false, title: "Edit Route", resizable: false,
position: {my: "center top+20", at: "top", of: d3.event, collision: "fit"}, position: {my: "center top+60", at: "top", of: d3.event, collision: "fit"},
close: closeRoutesEditor close: closeRoutesEditor
}); });