refactor: layers basic typization

This commit is contained in:
Azgaar 2022-07-05 20:33:28 +03:00
parent 7c2c624417
commit 1847772d74
15 changed files with 337 additions and 194 deletions

View file

@ -24,7 +24,7 @@ styleElements.addEventListener("change", function (ev) {
});
// select element to be edited
function editStyle(element, group) {
export function editStyle(element, group) {
showOptions();
styleTab.click();
styleElementSelect.value = element;
@ -403,7 +403,7 @@ styleGridScale.addEventListener("input", function () {
calculateFriendlyGridSize();
});
function calculateFriendlyGridSize() {
export function calculateFriendlyGridSize() {
const size = styleGridScale.value * 25;
const friendly = `${rn(size * distanceScaleInput.value, 2)} ${distanceUnitInput.value}`;
styleGridSizeFriendly.value = friendly;
@ -537,7 +537,7 @@ styleCompassSizeInput.addEventListener("input", function () {
styleCompassShiftX.addEventListener("input", shiftCompass);
styleCompassShiftY.addEventListener("input", shiftCompass);
function shiftCompass() {
export function shiftCompass() {
const tr = `translate(${styleCompassShiftX.value} ${styleCompassShiftY.value}) scale(${styleCompassSizeInput.value})`;
compass.select("use").attr("transform", tr);
}

View file

@ -3,7 +3,7 @@ import {findCell} from "utils/graphUtils";
import {last} from "utils/arrayUtils";
import {tip, clearMainTip} from "scripts/tooltips";
import {rn} from "utils/numberUtils";
import {isCtrlClick} from "utils/keyboardUtils";
import {isCtrlPressed} from "utils/keyboardUtils";
import {prompt} from "scripts/prompt";
import {getNextId} from "utils/nodeUtils";
import {P, generateSeed} from "utils/probabilityUtils";
@ -444,7 +444,7 @@ function regenerateMarkers() {
}
function regenerateZones(event) {
if (isCtrlClick(event))
if (isCtrlPressed(event))
prompt("Please provide zones number multiplier", {default: 1, step: 0.01, min: 0, max: 100}, v =>
addNumberOfZones(v)
);