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,10 +10,11 @@ function editRiver(id) {
viewbox.on("touchmove mousemove", showEditorTips);
debug.append("g").attr("id", "controlPoints").attr("transform", elSelected.attr("transform"));
drawControlPoints(node);
updateRiverName(node);
$("#riverEditor").dialog({
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
});
@ -44,6 +45,13 @@ function editRiver(id) {
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) {
const l = node.getTotalLength() / 2;
const segments = Math.ceil(l / 8);