Skip to content

Commit 8ae1e55

Browse files
author
tamat
committed
Merge branch 'master' of https://github.com/jagenjo/litegraph.js
2 parents 42cbc58 + 684a545 commit 8ae1e55

16 files changed

+11667
-163
lines changed

.eslintrc renamed to .eslintrc.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
{
2-
"extends": "eslint:recommended",
3-
"parserOptions": {
4-
"ecmaVersion": 5
5-
},
1+
module.exports = {
62
"env": {
73
"browser": true,
8-
"node": true
4+
"es2021": true,
5+
"node": true,
6+
"jest/globals": true
7+
},
8+
"extends": "eslint:recommended",
9+
"overrides": [
10+
],
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"sourceType": "module"
914
},
15+
"plugins": ["jest"],
1016
"globals": {
1117
"gl": true,
1218
"GL": true,

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules/*
33
npm-debug.log
44
temp/
55
temp/*
6+
coverage/
67

78
# Editors
89
/.vscode/*

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ You can write any feedback to [email protected]
176176

177177
## Contributors
178178

179+
- atlasan
179180
- kriffe
180181
- rappestad
181182
- InventivetalentDev

editor/js/code.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,30 @@ LiteGraph.node_images_path = "../nodes_data/";
55
var editor = new LiteGraph.Editor("main",{miniwindow:false});
66
window.graphcanvas = editor.graphcanvas;
77
window.graph = editor.graph;
8-
window.addEventListener("resize", function() { editor.graphcanvas.resize(); } );
8+
updateEditorHiPPICanvas();
9+
window.addEventListener("resize", function() {
10+
editor.graphcanvas.resize();
11+
updateEditorHiPPICanvas();
12+
} );
913
//window.addEventListener("keydown", editor.graphcanvas.processKey.bind(editor.graphcanvas) );
1014
window.onbeforeunload = function(){
1115
var data = JSON.stringify( graph.serialize() );
1216
localStorage.setItem("litegraphg demo backup", data );
1317
}
1418

19+
function updateEditorHiPPICanvas() {
20+
const ratio = window.devicePixelRatio;
21+
if(ratio == 1) { return }
22+
const rect = editor.canvas.parentNode.getBoundingClientRect();
23+
const { width, height } = rect;
24+
editor.canvas.width = width * ratio;
25+
editor.canvas.height = height * ratio;
26+
editor.canvas.style.width = width + "px";
27+
editor.canvas.style.height = height + "px";
28+
editor.canvas.getContext("2d").scale(ratio, ratio);
29+
return editor.canvas;
30+
}
31+
1532
//enable scripting
1633
LiteGraph.allow_scripts = true;
1734

editor/js/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LiteGraph.slot_types_out = []; // slot types OUT*/
2525

2626
LiteGraph.alt_drag_do_clone_nodes = true; // [true!] very handy; ALT click to clone and drag the new node
2727
LiteGraph.do_add_triggers_slots = true; // [true!] will create and connect event slots when using action/events connections; !WILL CHANGE node mode when using onTrigger (enable mode colors); onExecuted does not need this
28-
LiteGraph.allow_multi_output_for_events = false; // [false!] being events; it is strongly reccomended to use them sequentually; one by one
28+
LiteGraph.allow_multi_output_for_events = false; // [false!] being events; it is strongly reccomended to use them sequentially; one by one
2929
LiteGraph.middle_click_slot_add_default_node = true; //[true!] allows to create and connect a ndoe clicking with the third button (wheel)
3030
LiteGraph.release_link_on_empty_shows_menu = true; //[true!] dragging a link to empty space will open a menu, add from list, search or defaults
3131
LiteGraph.pointerevents_method = "mouse"; // "mouse"|"pointer" use mouse for retrocompatibility issues? (none found @ now)

editor/js/defaults_mobile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LiteGraph.slot_types_out = []; // slot types OUT*/
2525

2626
LiteGraph.alt_drag_do_clone_nodes = true; // [true!] very handy; ALT click to clone and drag the new node
2727
LiteGraph.do_add_triggers_slots = true; // [true!] will create and connect event slots when using action/events connections; !WILL CHANGE node mode when using onTrigger (enable mode colors); onExecuted does not need this
28-
LiteGraph.allow_multi_output_for_events = false; // [false!] being events; it is strongly reccomended to use them sequentually; one by one
28+
LiteGraph.allow_multi_output_for_events = false; // [false!] being events; it is strongly reccomended to use them sequentially; one by one
2929
LiteGraph.middle_click_slot_add_default_node = true; //[true!] allows to create and connect a ndoe clicking with the third button (wheel)
3030
LiteGraph.release_link_on_empty_shows_menu = true; //[true!] dragging a link to empty space will open a menu, add from list, search or defaults
3131
LiteGraph.pointerevents_method = "pointer"; // "mouse"|"pointer" use mouse for retrocompatibility issues? (none found @ now)

jest.config.js

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
/*
2+
* For a detailed explanation regarding each configuration property, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
6+
module.exports = {
7+
// All imported modules in your tests should be mocked automatically
8+
// automock: false,
9+
10+
// Stop running tests after `n` failures
11+
// bail: 0,
12+
13+
// The directory where Jest should store its cached dependency information
14+
// cacheDirectory: "/tmp/jest_rs",
15+
16+
// Automatically clear mock calls, instances, contexts and results before every test
17+
// clearMocks: false,
18+
19+
// Indicates whether the coverage information should be collected while executing the test
20+
collectCoverage: true,
21+
22+
// An array of glob patterns indicating a set of files for which coverage information should be collected
23+
// collectCoverageFrom: undefined,
24+
25+
// The directory where Jest should output its coverage files
26+
coverageDirectory: "coverage",
27+
28+
// An array of regexp pattern strings used to skip coverage collection
29+
// coveragePathIgnorePatterns: [
30+
// "/node_modules/"
31+
// ],
32+
33+
// Indicates which provider should be used to instrument code for coverage
34+
// coverageProvider: "babel",
35+
36+
// A list of reporter names that Jest uses when writing coverage reports
37+
// coverageReporters: [
38+
// "json",
39+
// "text",
40+
// "lcov",
41+
// "clover"
42+
// ],
43+
44+
// An object that configures minimum threshold enforcement for coverage results
45+
// coverageThreshold: undefined,
46+
47+
// A path to a custom dependency extractor
48+
// dependencyExtractor: undefined,
49+
50+
// Make calling deprecated APIs throw helpful error messages
51+
// errorOnDeprecated: false,
52+
53+
// The default configuration for fake timers
54+
// fakeTimers: {
55+
// "enableGlobally": false
56+
// },
57+
58+
// Force coverage collection from ignored files using an array of glob patterns
59+
// forceCoverageMatch: [],
60+
61+
// A path to a module which exports an async function that is triggered once before all test suites
62+
// globalSetup: undefined,
63+
64+
// A path to a module which exports an async function that is triggered once after all test suites
65+
// globalTeardown: undefined,
66+
67+
// A set of global variables that need to be available in all test environments
68+
// globals: {},
69+
70+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
71+
// maxWorkers: "50%",
72+
73+
// An array of directory names to be searched recursively up from the requiring module's location
74+
// moduleDirectories: [
75+
// "node_modules"
76+
// ],
77+
78+
// An array of file extensions your modules use
79+
// moduleFileExtensions: [
80+
// "js",
81+
// "mjs",
82+
// "cjs",
83+
// "jsx",
84+
// "ts",
85+
// "tsx",
86+
// "json",
87+
// "node"
88+
// ],
89+
90+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
91+
// moduleNameMapper: {},
92+
93+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
94+
// modulePathIgnorePatterns: [],
95+
96+
// Activates notifications for test results
97+
// notify: false,
98+
99+
// An enum that specifies notification mode. Requires { notify: true }
100+
// notifyMode: "failure-change",
101+
102+
// A preset that is used as a base for Jest's configuration
103+
// preset: undefined,
104+
105+
// Run tests from one or more projects
106+
// projects: undefined,
107+
108+
// Use this configuration option to add custom reporters to Jest
109+
// reporters: undefined,
110+
111+
// Automatically reset mock state before every test
112+
// resetMocks: false,
113+
114+
// Reset the module registry before running each individual test
115+
// resetModules: false,
116+
117+
// A path to a custom resolver
118+
// resolver: undefined,
119+
120+
// Automatically restore mock state and implementation before every test
121+
// restoreMocks: false,
122+
123+
// The root directory that Jest should scan for tests and modules within
124+
// rootDir: undefined,
125+
126+
// A list of paths to directories that Jest should use to search for files in
127+
// roots: [
128+
// "<rootDir>"
129+
// ],
130+
131+
// Allows you to use a custom runner instead of Jest's default test runner
132+
// runner: "jest-runner",
133+
134+
// The paths to modules that run some code to configure or set up the testing environment before each test
135+
// setupFiles: [],
136+
137+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
138+
// setupFilesAfterEnv: [],
139+
140+
// The number of seconds after which a test is considered as slow and reported as such in the results.
141+
// slowTestThreshold: 5,
142+
143+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
144+
// snapshotSerializers: [],
145+
146+
// The test environment that will be used for testing
147+
// testEnvironment: "jest-environment-node",
148+
149+
// Options that will be passed to the testEnvironment
150+
// testEnvironmentOptions: {},
151+
152+
// Adds a location field to test results
153+
// testLocationInResults: false,
154+
155+
// The glob patterns Jest uses to detect test files
156+
// testMatch: [
157+
// "**/__tests__/**/*.[jt]s?(x)",
158+
// "**/?(*.)+(spec|test).[tj]s?(x)"
159+
// ],
160+
161+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
162+
// testPathIgnorePatterns: [
163+
// "/node_modules/"
164+
// ],
165+
166+
// The regexp pattern or array of patterns that Jest uses to detect test files
167+
// testRegex: [],
168+
169+
// This option allows the use of a custom results processor
170+
// testResultsProcessor: undefined,
171+
172+
// This option allows use of a custom test runner
173+
// testRunner: "jest-circus/runner",
174+
175+
// A map from regular expressions to paths to transformers
176+
// transform: undefined,
177+
178+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
179+
// transformIgnorePatterns: [
180+
// "/node_modules/",
181+
// "\\.pnp\\.[^\\/]+$"
182+
// ],
183+
184+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
185+
// unmockedModulePathPatterns: undefined,
186+
187+
// Indicates whether each individual test should be reported during the run
188+
// verbose: undefined,
189+
190+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
191+
// watchPathIgnorePatterns: [],
192+
193+
// Whether to use watchman for file crawling
194+
// watchman: true,
195+
};

0 commit comments

Comments
 (0)