Fix naming.

This commit is contained in:
Conrad Nelson 2025-12-17 12:01:12 -06:00
parent 24b74f78c0
commit b4c448d572

View file

@ -238,7 +238,7 @@ let historyIndex = 0
let sizingRAF = 0;
let lastApplied = { w: 0, h: 0 };
const ro = new ResizeObserver(scheduleSnappedcellSize);
const ro = new ResizeObserver(scheduleSnappedCellSize);
ro.observe(gridWrapEl);
const savedTool = localStorage.getItem('gridTool');
@ -254,7 +254,7 @@ if (savedType) {
resizeAndSetupCanvas();
setGrid();
scheduleSnappedcellSize();
scheduleSnappedCellSize();
function pxToDocPoint(clientX, clientY) {
const rect = gridEl.getBoundingClientRect();
@ -359,7 +359,7 @@ function snapDown(n, step) {
return Math.floor(n / step) * step;
}
function applySnappedcellSize() {
function applySnappedCellSize() {
sizingRAF = 0;
const grid = cellSize;
@ -383,12 +383,12 @@ function applySnappedcellSize() {
resizeAndSetupCanvas();
}
function scheduleSnappedcellSize() {
function scheduleSnappedCellSize() {
if (sizingRAF) return;
sizingRAF = requestAnimationFrame(applySnappedcellSize);
sizingRAF = requestAnimationFrame(applySnappedCellSize);
}
function applycellSize(newSize) {
function applyCellSize(newSize) {
const n = Number(newSize);
if (!Number.isFinite(n) || n < 1) return;
@ -401,7 +401,7 @@ function applycellSize(newSize) {
dotSVGEl.setAttribute('height', dotSize);
setGrid();
scheduleSnappedcellSize();
scheduleSnappedCellSize();
}
function pxToGrid(v) {
@ -545,7 +545,6 @@ function redrawAll() {
function drawShape(shape) {
if (!ctx) return;
const toPx = (v) => v * cellSize;
ctx.save();
@ -595,8 +594,6 @@ function drawShape(shape) {
} else if (shape.type === 'path') {
const toPx = (v) => v * cellSize;
ctx.save();
ctx.strokeStyle = shape.color || '#000000';
ctx.globalAlpha = clamp01(shape.opacity, 1);
ctx.lineWidth = Math.max(1, toPx(shape.width ?? 0.12));
@ -678,8 +675,8 @@ document.querySelectorAll('input[name="gridType"]').forEach(input => {
});
});
cellSizeEl.addEventListener('input', () => applycellSize(cellSizeEl.value));
cellSizeEl.addEventListener('change', () => applycellSize(cellSizeEl.value));
cellSizeEl.addEventListener('input', () => applyCellSize(cellSizeEl.value));
cellSizeEl.addEventListener('change', () => applyCellSize(cellSizeEl.value));
importButtonEl.addEventListener('click', () => importEl.click());
@ -694,7 +691,7 @@ importEl.addEventListener('change', (e) => {
if (Number.isFinite(Number(data.cellSize)) && Number(data.cellSize) >= 1) {
cellSizeEl.value = data.cellSize;
applycellSize(data.cellSize);
applyCellSize(data.cellSize);
}
const loadedShapes = Array.isArray(data) ? data : data.shapes;
@ -735,7 +732,7 @@ exportEl.addEventListener('click', () => {
clearEl.addEventListener('click', () => {
cellSize = 25;
cellSizeEl.value = 25;
applycellSize(25);
applyCellSize(25);
commit([]);
});