removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
function resizeCanvas() {
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const perfScale = window.TarinaiPerf?.dprScale?.() || 1;
|
||||
const perfScale = window.TarinaiPerf.dprScale();
|
||||
const dpr = Math.max(0.5, Math.min((window.devicePixelRatio || 1) * perfScale, 2));
|
||||
const nextW = Math.max(1, Math.floor(rect.width * dpr));
|
||||
const nextH = Math.max(1, Math.floor(rect.height * dpr));
|
||||
|
|
@ -20,11 +20,12 @@ function resizeCanvas() {
|
|||
|
||||
function applyFieldLayout(fieldType = world.fieldType || "garden") {
|
||||
const field = FIELD_TYPES?.[fieldType] || FIELD_TYPES.garden;
|
||||
const layout = FIELD_LAYOUT;
|
||||
const root = document.documentElement;
|
||||
root.style.setProperty("--field-height", field.height);
|
||||
root.style.setProperty("--field-min-height", field.minHeight || field.height);
|
||||
root.style.setProperty("--field-mobile-height", field.mobileHeight || field.height);
|
||||
root.style.setProperty("--field-mobile-min-height", field.mobileMinHeight || field.mobileHeight || "460px");
|
||||
root.style.setProperty("--field-height", layout.height);
|
||||
root.style.setProperty("--field-min-height", layout.minHeight);
|
||||
root.style.setProperty("--field-mobile-height", layout.mobileHeight);
|
||||
root.style.setProperty("--field-mobile-min-height", layout.mobileMinHeight);
|
||||
world.fieldType = field.id;
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
world.setViewportSize(rect.width, rect.height);
|
||||
|
|
@ -87,17 +88,10 @@ function resetWithField(fieldType) {
|
|||
render();
|
||||
}
|
||||
|
||||
function screenToWorld(e) {
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const touch = e.touches ? e.touches[0] : e;
|
||||
const sx = touch.clientX - rect.left;
|
||||
const sy = touch.clientY - rect.top;
|
||||
return world.screenToWorld ? world.screenToWorld(sx, sy) : { x: sx, y: sy };
|
||||
}
|
||||
|
||||
function resizeFieldFromWheel(e) {
|
||||
const itemType = typeof toolItemType === "function" ? toolItemType(world?.tool || "") : "";
|
||||
if ((e.shiftKey || e.altKey) && itemType && typeof isRotatableItemType === "function" && isRotatableItemType(itemType) && world?.rotateToolAngle) {
|
||||
const itemType = toolItemType(world?.tool || "");
|
||||
if ((e.shiftKey || e.altKey) && itemType && isRotatableItemType(itemType) && world?.rotateToolAngle) {
|
||||
e.preventDefault();
|
||||
const step = (e.altKey ? 1 : 5) * Math.PI / 180;
|
||||
world.rotateToolAngle(itemType, (e.deltaY > 0 ? 1 : -1) * step);
|
||||
|
|
@ -122,7 +116,7 @@ function resizeFieldFromWheel(e) {
|
|||
|
||||
function selectTool(tool) {
|
||||
const wasCopyArmed = world.tool === "copy" && tool === "copy" && Boolean(world.copyBuffer);
|
||||
const result = window.TarinaiCommands?.dispatch?.(world, { type: "tool.select", toolId: tool });
|
||||
const result = window.TarinaiCommands.dispatch(world, { type: "tool.select", toolId: tool });
|
||||
const activeTool = result?.toolId || world.tool || tool;
|
||||
if (activeTool !== "rope" && activeTool !== "rod") world.pendingLinkEndpoint = null;
|
||||
if (activeTool !== "copy") world.copyBuffer = null;
|
||||
|
|
@ -134,7 +128,7 @@ function selectTool(tool) {
|
|||
btn.classList.toggle("selected", btn.dataset.tool === activeTool);
|
||||
}
|
||||
syncToolSizeBadges();
|
||||
canvas.style.cursor = window.TarinaiUIInputShared?.cursorForTool?.(activeTool) || (activeTool === "observe" ? "default" : (activeTool === "pinch" ? "grab" : (activeTool === "poke" || activeTool === "delete" ? "pointer" : "crosshair")));
|
||||
canvas.style.cursor = window.TarinaiUIInputShared.cursorForTool(activeTool) || (activeTool === "observe" ? "default" : (activeTool === "pinch" ? "grab" : (activeTool === "poke" || activeTool === "delete" ? "pointer" : "crosshair")));
|
||||
}
|
||||
|
||||
function showToast(text) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue