-
Notifications
You must be signed in to change notification settings - Fork 4
new export :) #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new export :) #122
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||||||||||||||||
| import * as THREE from 'three'; | ||||||||||||||||||||||||
| import {CameraType, ModuleType, MoveType, VisConfigData} from "./utils.js"; | ||||||||||||||||||||||||
| import {CameraType, ModuleType, MoveType, VisConfigData, pathfinderData} from "./utils.js"; | ||||||||||||||||||||||||
| import { Module } from "./Module.js"; | ||||||||||||||||||||||||
| import { Move } from "./Move.js"; | ||||||||||||||||||||||||
| import { MoveSet } from "./MoveSet.js"; | ||||||||||||||||||||||||
|
|
@@ -24,6 +24,10 @@ export class Scenario { | |||||||||||||||||||||||
| // Reset Data | ||||||||||||||||||||||||
| VisConfigData.nextModID = 0; | ||||||||||||||||||||||||
| VisConfigData.clearBounds(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Store the scenario content for export | ||||||||||||||||||||||||
| pathfinderData.currentScenario = rawString; | ||||||||||||||||||||||||
| console.log("Stored scenario content, length:", rawString ? rawString.length : 0); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // remove '\r' characters | ||||||||||||||||||||||||
| rawString = rawString.replace(/\r/g, ''); | ||||||||||||||||||||||||
|
Comment on lines
+28
to
33
|
||||||||||||||||||||||||
| // Store the scenario content for export | |
| pathfinderData.currentScenario = rawString; | |
| console.log("Stored scenario content, length:", rawString ? rawString.length : 0); | |
| // remove '\r' characters | |
| rawString = rawString.replace(/\r/g, ''); | |
| // remove '\r' characters | |
| rawString = rawString.replace(/\r/g, ''); | |
| // Store the scenario content for export | |
| pathfinderData.currentScenario = rawString; | |
| console.log("Stored scenario content, length:", rawString ? rawString.length : 0); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -85,6 +85,8 @@ export let pathfinderData = { | |||||||||||||||||||||||||||||||||||||
| config_i: '{"exists": false}', | ||||||||||||||||||||||||||||||||||||||
| config_f: '{"exists": false}', | ||||||||||||||||||||||||||||||||||||||
| scen_out: 'INVALID SCENE', | ||||||||||||||||||||||||||||||||||||||
| currentScenario: null, // Stores the currently loaded scenario content | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| currentScenario: null, // Stores the currently loaded scenario content | |
| // Stores the currently loaded scenario content (parsed/cleaned version only) | |
| _currentScenario: null, | |
| setCurrentScenario: function(scenarioContent) { | |
| // Only allow storing if under 5MB (5 * 1024 * 1024 bytes) | |
| const MAX_SCENARIO_SIZE = 5 * 1024 * 1024; | |
| if (typeof scenarioContent === "string" && scenarioContent.length > MAX_SCENARIO_SIZE) { | |
| console.warn("Scenario content too large to store in memory. Max allowed is 5MB."); | |
| this._currentScenario = null; | |
| return false; | |
| } | |
| // If scenarioContent is a parsed object, store directly | |
| this._currentScenario = scenarioContent; | |
| return true; | |
| }, | |
| get currentScenario() { | |
| return this._currentScenario; | |
| }, |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug console.log statements should be removed before merging to production. These statements add unnecessary noise to the console output and can impact performance in production environments.
| console.log("Download scenario called - currentScenario:", pathfinderData.currentScenario ? "exists" : "null"); | |
| console.log("Download scenario called - scen_out:", pathfinderData.scen_out); |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message uses console.warn but doesn't provide user-facing feedback. Users who click the "Download Scenario" button when no scenario is loaded won't see any visible indication of why nothing happened. Consider adding a visible alert or notification to inform the user.
| console.warn("No valid scenario to download. Please load a scenario first."); | |
| console.warn("No valid scenario to download. Please load a scenario first."); | |
| window.alert("No valid scenario to download. Please load a scenario first."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug console.log statement should be removed before merging to production. This statement adds unnecessary noise to the console output and can impact performance in production environments.