mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
Add initial Pico-8 cartridges for testing
- Created test_cart.p8 with basic drawing functionality and a print statement. - Created test_unix.p8 with a simple initialization function.
This commit is contained in:
@@ -188,10 +188,14 @@ export class WorkspaceDropManager {
|
||||
|
||||
this.#workspace.paletteManager.handleDragEnd();
|
||||
|
||||
const spawn = WorkspaceGeometry.snapPositionToGrid(
|
||||
this.#workspace,
|
||||
WorkspaceGeometry.eventToWorkspacePoint(this.#workspace, event)
|
||||
);
|
||||
// Snap to grid first, then offset for centering (consistent with ghost positioning)
|
||||
const cursorWorld = WorkspaceGeometry.eventToWorkspacePoint(this.#workspace, event);
|
||||
const snapped = WorkspaceGeometry.snapPositionToGrid(this.#workspace, cursorWorld);
|
||||
// Offset spawn to match the centered ghost position (roughly half ghost size)
|
||||
const spawn = {
|
||||
x: snapped.x - 110,
|
||||
y: snapped.y - 70,
|
||||
};
|
||||
|
||||
this.#workspace.addNode(definitionId, spawn);
|
||||
}
|
||||
@@ -214,10 +218,12 @@ export class WorkspaceDropManager {
|
||||
|
||||
const definitions = this.#getVariableSpawnDefinitions(variableId);
|
||||
if (!definitions.length) {
|
||||
const spawn = WorkspaceGeometry.snapPositionToGrid(
|
||||
this.#workspace,
|
||||
WorkspaceGeometry.eventToWorkspacePoint(this.#workspace, event)
|
||||
);
|
||||
const cursorWorld = WorkspaceGeometry.eventToWorkspacePoint(this.#workspace, event);
|
||||
const snapped = WorkspaceGeometry.snapPositionToGrid(this.#workspace, cursorWorld);
|
||||
const spawn = {
|
||||
x: snapped.x - 110,
|
||||
y: snapped.y - 70,
|
||||
};
|
||||
const fallback = this.#workspace.addNode("get_var", spawn);
|
||||
if (fallback) {
|
||||
const nodeName = variable.name || variable.id;
|
||||
|
||||
Reference in New Issue
Block a user