sunrize 2.4.1 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/package.json +7 -7
  2. package/src/Application/Application.js +22 -2
  3. package/src/Application/Dashboard.js +21 -19
  4. package/src/Application/DataStorage.js +10 -37
  5. package/src/Application/Document.js +149 -22
  6. package/src/Application/Footer.js +62 -16
  7. package/src/Application/Hierarchy.js +1 -1
  8. package/src/Application/Interface.js +1 -1
  9. package/src/Application/Sidebar.js +12 -9
  10. package/src/Application/Tabs.js +79 -11
  11. package/src/Controls/Splitter.js +146 -19
  12. package/src/Controls/Tabs.js +17 -12
  13. package/src/Editors/AnimationEditor.js +83 -59
  14. package/src/Editors/AnimationMemberList.js +37 -6
  15. package/src/Editors/BrowserFrame.js +17 -10
  16. package/src/Editors/Console.js +12 -14
  17. package/src/Editors/NodeList.js +35 -0
  18. package/src/Editors/OutlineEditor.js +24 -22
  19. package/src/Editors/OutlineView.js +85 -61
  20. package/src/Editors/Panel.js +6 -3
  21. package/src/Editors/RouteGraph.js +22 -65
  22. package/src/Editors/SceneProperties.js +9 -5
  23. package/src/Editors/ScriptEditor.js +37 -23
  24. package/src/Editors/VideoRecorder.js +145 -0
  25. package/src/Tools/Core/X3DBaseTool.js +12 -11
  26. package/src/Tools/Core/X3DImportedNodeInstanceTool.js +52 -0
  27. package/src/Tools/Core/X3DPrototypeInstanceTool.js +6 -6
  28. package/src/Tools.js +0 -3
  29. package/src/Undo/Editor.js +19 -16
  30. package/src/Undo/UndoManager.js +1 -1
  31. package/src/assets/fonts/Roboto/OFL.txt +93 -0
  32. package/src/assets/fonts/Roboto/README.txt +118 -0
  33. package/src/assets/fonts/Roboto/Roboto-Italic-VariableFont_wdth,wght.ttf +0 -0
  34. package/src/assets/fonts/Roboto/Roboto-VariableFont_wdth,wght.ttf +0 -0
  35. package/src/assets/fonts/Roboto_Mono/OFL.txt +93 -0
  36. package/src/assets/fonts/Roboto_Mono/README.txt +77 -0
  37. package/src/assets/fonts/Roboto_Mono/RobotoMono-Italic-VariableFont_wght.ttf +0 -0
  38. package/src/assets/fonts/Roboto_Mono/RobotoMono-VariableFont_wght.ttf +0 -0
  39. package/src/assets/html/application.html +38 -13
  40. package/src/assets/html/window.html +6 -7
  41. package/src/assets/themes/default.css +186 -176
  42. package/src/assets/themes/{system-colors.css → definitions.css} +155 -173
  43. package/src/assets/themes/fonts.css +45 -0
  44. package/src/assets/themes/media-template.css +3 -2
  45. package/src/assets/themes/media.css +3 -2
  46. package/src/assets/themes/prompt-template.css +5 -1
  47. package/src/assets/themes/prompt.css +5 -1
  48. package/src/assets/html/application-template.html +0 -164
  49. package/src/assets/html/window-template.html +0 -39
@@ -62,166 +62,167 @@ module .exports = class AnimationEditor extends Interface
62
62
 
63
63
  // Toolbar
64
64
 
65
- this .toolbar = $("<div></div>")
66
- .attr ("id", "animation-editor-toolbar")
67
- .addClass (["animation-editor-toolbar", "toolbar", "horizontal-toolbar"])
65
+ this .controls = $("<div></div>")
66
+ .attr ("id", "animation-editor-controls")
67
+ .addClass (["animation-editor-controls", "toolbar", "horizontal-toolbar"])
68
68
  .appendTo (this .animationEditor);
69
69
 
70
70
  this .createAnimationIcon = $("<span></span>")
71
71
  .addClass (["material-symbols-outlined", "disabled"])
72
+ .css ("scale", "0.8")
72
73
  .attr ("title", _("Create animation."))
73
74
  .text ("animation")
74
- .appendTo (this .toolbar)
75
+ .appendTo (this .controls)
75
76
  .on ("click", () => this .createAnimation ());
76
77
 
77
- $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
78
+ $("<span></span>") .addClass ("separator") .appendTo (this .controls);
78
79
 
79
80
  this .addMembersIcon = $("<span></span>")
80
- .addClass ("material-icons")
81
+ .addClass ("material-symbols-outlined")
81
82
  .attr ("title", _("Add member(s) to animation."))
82
83
  .text ("add")
83
- .appendTo (this .toolbar)
84
+ .appendTo (this .controls)
84
85
  .on ("click", () => this .addMembers ());
85
86
 
86
- $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
87
+ $("<span></span>") .addClass ("separator") .appendTo (this .controls);
87
88
 
88
89
  this .cutFrameIcon = $("<span></span>")
89
- .addClass ("material-icons")
90
+ .addClass ("material-symbols-outlined")
91
+ .css ("scale", "0.7")
90
92
  .attr ("title", darwin
91
93
  ? _("Cut selected keyframes. (⌘X)")
92
94
  : _("Cut selected keyframes. (Ctrl+X)"))
93
95
  .text ("content_cut")
94
- .appendTo (this .toolbar)
96
+ .appendTo (this .controls)
95
97
  .on ("click", () => this .cutKeyframes ());
96
98
 
97
99
  this .copyFrameIcon = $("<span></span>")
98
- .addClass ("material-icons")
100
+ .addClass ("material-symbols-outlined")
101
+ .css ("scale", "0.7")
99
102
  .attr ("title", darwin
100
103
  ? _("Copy selected keyframes. (⌘C)")
101
104
  : _("Copy selected keyframes. (Ctrl+C)"))
102
105
  .text ("content_copy")
103
- .appendTo (this .toolbar)
106
+ .appendTo (this .controls)
104
107
  .on ("click", () => this .copyKeyframes ());
105
108
 
106
109
  this .pasteFrameIcon = $("<span></span>")
107
- .addClass ("material-icons")
110
+ .addClass ("material-symbols-outlined")
111
+ .css ("scale", "0.7")
108
112
  .attr ("title", darwin
109
113
  ? _("Paste keyframes at current frame. (⌘V)")
110
114
  : _("Paste keyframes at current frame. (Ctrl+V)"))
111
115
  .text ("content_paste")
112
- .appendTo (this .toolbar)
116
+ .appendTo (this .controls)
113
117
  .on ("click", () => this .pasteKeyframes ());
114
118
 
115
- $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
119
+ $("<span></span>") .addClass ("separator") .appendTo (this .controls);
116
120
 
117
121
  this .firstFrameIcon = $("<span></span>")
118
- .addClass ("material-icons")
122
+ .addClass ("material-symbols-outlined")
123
+ .css ("scale", "0.8")
119
124
  .attr ("title", _("Go to first frame."))
120
125
  .text ("first_page")
121
- .appendTo (this .toolbar)
126
+ .appendTo (this .controls)
122
127
  .on ("click", () => this .firstFrame ());
123
128
 
124
129
  this .toggleAnimationIcon = $("<span></span>")
125
- .addClass ("material-icons")
130
+ .addClass (["material-symbols-outlined", "fill"])
131
+ .css ("scale", "0.8")
126
132
  .attr ("title", _("Start animation. (Space)"))
127
133
  .text ("play_arrow")
128
- .appendTo (this .toolbar)
134
+ .appendTo (this .controls)
129
135
  .on ("click", () => this .toggleAnimation ());
130
136
 
131
137
  this .lastFrameIcon = $("<span></span>")
132
- .addClass ("material-icons")
138
+ .addClass ("material-symbols-outlined")
139
+ .css ("scale", "0.8")
133
140
  .attr ("title", _("Go to last frame."))
134
141
  .text ("last_page")
135
- .appendTo (this .toolbar)
142
+ .appendTo (this .controls)
136
143
  .on ("click", () => this .lastFrame ());
137
144
 
138
145
  this .loopIcon = $("<span></span>")
139
- .addClass ("material-icons")
146
+ .addClass ("material-symbols-outlined")
147
+ .css ("scale", "0.7")
140
148
  .attr ("title", _("Loop animation."))
141
- .text ("loop")
142
- .appendTo (this .toolbar)
149
+ .text ("repeat")
150
+ .appendTo (this .controls)
143
151
  .on ("click", () => this .toggleLoop ());
144
152
 
145
153
  this .frameInput = $("<input></input>")
146
154
  .addClass ("input")
155
+ .css ("width", "70px")
147
156
  .attr ("type", "number")
148
157
  .attr ("step", 1)
149
158
  .attr ("min", 0)
150
159
  .attr ("max", 0)
151
160
  .attr ("title", _("Current frame."))
152
- .css ("width", "70px")
153
- .appendTo (this .toolbar)
161
+ .appendTo (this .controls)
154
162
  .on ("change input", () => this .setCurrentFrame (this .getCurrentFrame ()));
155
163
 
156
164
  this .propertiesIcon = $("<span></span>")
157
- .addClass ("material-icons")
165
+ .addClass ("material-symbols-outlined")
166
+ .css ("scale", "0.7")
158
167
  .attr ("title", _("Edit animation properties."))
159
168
  .text ("access_time")
160
- .appendTo (this .toolbar)
169
+ .appendTo (this .controls)
161
170
  .on ("click", () => this .showProperties ());
162
171
 
163
- $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
172
+ $("<span></span>") .addClass ("separator") .appendTo (this .controls);
164
173
 
165
174
  this .keyTypeElement = $("<select></select>")
166
175
  .addClass ("select")
176
+ .css ("margin-left", "5px")
167
177
  .attr ("title", _("Select keyframe type."))
168
178
  .append ($("<option></option>") .text ("CONSTANT"))
169
179
  .append ($("<option></option>") .text ("LINEAR") .attr ("selected", ""))
170
180
  .append ($("<option></option>") .text ("SPLINE"))
171
181
  .append ($("<option></option>") .text ("SPLIT"))
172
182
  .append ($("<option></option>") .text ("MIXED") .hide ())
173
- .appendTo (this .toolbar)
183
+ .appendTo (this .controls)
174
184
  .on ("change", () => this .setKeyType ());
175
185
 
176
186
  this .timeElement = $("<span></span>")
177
- .addClass (["text", "right"])
187
+ .addClass ("text")
188
+ .css ("margin-left", "auto")
178
189
  .attr ("title", _("Current frame time (hours:minutes:seconds:frames)."))
179
- .css ("top", "7.5px")
180
- .css ("margin-right", "6px")
181
190
  .text (this .formatFrames (0, 10))
182
- .appendTo (this .toolbar);
191
+ .appendTo (this .controls);
183
192
 
184
193
  // Navigation toolbar
185
194
 
186
- this .navigation = $("<div></div>")
187
- .attr ("id", "animation-editor-navigation")
188
- .addClass (["animation-editor-navigation", "toolbar", "vertical-toolbar", "secondary-toolbar"])
195
+ this .toolbar = $("<div></div>")
196
+ .attr ("id", "animation-editor-toolbar")
197
+ .addClass (["animation-editor-toolbar", "toolbar", "vertical-toolbar", "secondary-toolbar"])
189
198
  .appendTo (this .animationEditor);
190
199
 
191
200
  this .zoomOutIcon = $("<span></span>")
192
- .addClass ("material-icons")
201
+ .addClass ("material-symbols-outlined")
193
202
  .attr ("title", _("Zoom timeline out. (-)"))
194
- .css ("transform", "scale(1.5)")
195
- .css ("margin-bottom", "15px")
196
203
  .text ("zoom_out")
197
- .appendTo (this .navigation)
204
+ .appendTo (this .toolbar)
198
205
  .on ("click", () => this .zoomOut ());
199
206
 
200
207
  this .zoomInIcon = $("<span></span>")
201
- .addClass ("material-icons")
208
+ .addClass ("material-symbols-outlined")
202
209
  .attr ("title", _("Zoom timeline in. (+)"))
203
- .css ("transform", "scale(1.5)")
204
- .css ("margin-bottom", "15px")
205
210
  .text ("zoom_in")
206
- .appendTo (this .navigation)
211
+ .appendTo (this .toolbar)
207
212
  .on ("click", () => this .zoomIn ());
208
213
 
209
214
  this .zoomFitIcon = $("<span></span>")
210
- .addClass ("material-icons")
215
+ .addClass ("material-symbols-outlined")
211
216
  .attr ("title", _("Zoom timeline to fit in window. (0)"))
212
- .css ("transform", "scale(1.4)")
213
- .css ("margin-bottom", "15px")
214
217
  .text ("fit_screen")
215
- .appendTo (this .navigation)
218
+ .appendTo (this .toolbar)
216
219
  .on ("click", () => this .zoomFit ());
217
220
 
218
221
  this .zoom100Icon = $("<span></span>")
219
- .addClass ("material-icons")
222
+ .addClass ("material-symbols-outlined")
220
223
  .attr ("title", _("Default timeline zoom. (1)"))
221
- .css ("transform", "scale(1.4)")
222
- .css ("margin-bottom", "15px")
223
224
  .text ("1x_mobiledata")
224
- .appendTo (this .navigation)
225
+ .appendTo (this .toolbar)
225
226
  .on ("click", () => this .zoom100 ());
226
227
 
227
228
  // Animations List
@@ -275,6 +276,10 @@ module .exports = class AnimationEditor extends Interface
275
276
 
276
277
  this .setSelection (selection);
277
278
 
279
+ // Visibility
280
+
281
+ document .addEventListener ("visibilitychange", () => this .visibility ());
282
+
278
283
  // Setup
279
284
 
280
285
  this .setup ();
@@ -295,6 +300,12 @@ module .exports = class AnimationEditor extends Interface
295
300
  this .requestDrawTimeline ();
296
301
  }
297
302
 
303
+ visibility ()
304
+ {
305
+ if (this .timeSensor)
306
+ this .timeSensor ._evenLive = !(document .webkitHidden ?? document .hidden);
307
+ }
308
+
298
309
  isAnimation (node)
299
310
  {
300
311
  if (!node .getType () .includes (X3D .X3DConstants .Group))
@@ -395,6 +406,10 @@ module .exports = class AnimationEditor extends Interface
395
406
  }
396
407
  else
397
408
  {
409
+ // TimeSensor
410
+
411
+ this .timeSensor = null;
412
+
398
413
  // Show Animations List
399
414
 
400
415
  this .updateMemberList ();
@@ -729,12 +744,9 @@ module .exports = class AnimationEditor extends Interface
729
744
 
730
745
  for (const route of interpolator ._value_changed .getOutputRoutes ())
731
746
  {
732
- const node = route .getDestinationNode ();
733
-
734
- if (!(node instanceof X3D .X3DNode))
735
- continue;
736
-
737
- const field = node .getField (route .getDestinationField ());
747
+ const
748
+ node = route .getDestinationNode (),
749
+ field = node .getField (route .getDestinationField ());
738
750
 
739
751
  this .members .add (node);
740
752
  this .fields .set (field, interpolator);
@@ -2340,6 +2352,9 @@ module .exports = class AnimationEditor extends Interface
2340
2352
 
2341
2353
  on_mousedown (event)
2342
2354
  {
2355
+ if (!this .animation)
2356
+ return;
2357
+
2343
2358
  $(document)
2344
2359
  .on ("mousemove.AnimationEditor", event => this .updatePointer (event))
2345
2360
  .on ("mouseup.AnimationEditor", event => this .on_mouseup (event))
@@ -2404,6 +2419,9 @@ module .exports = class AnimationEditor extends Interface
2404
2419
 
2405
2420
  on_mouseup (event)
2406
2421
  {
2422
+ if (!this .animation)
2423
+ return;
2424
+
2407
2425
  $(document) .off (".AnimationEditor");
2408
2426
 
2409
2427
  this .updatePointer (event);
@@ -2420,6 +2438,9 @@ module .exports = class AnimationEditor extends Interface
2420
2438
 
2421
2439
  on_mousemove (event)
2422
2440
  {
2441
+ if (!this .animation)
2442
+ return;
2443
+
2423
2444
  switch (this .#button)
2424
2445
  {
2425
2446
  case undefined:
@@ -2439,6 +2460,9 @@ module .exports = class AnimationEditor extends Interface
2439
2460
 
2440
2461
  on_wheel (event)
2441
2462
  {
2463
+ if (!this .animation)
2464
+ return;
2465
+
2442
2466
  const deltaY = event .originalEvent .deltaY;
2443
2467
 
2444
2468
  this .updatePointer (event);
@@ -18,6 +18,13 @@ module .exports = class AnimationMembersList extends Interface
18
18
  #animation;
19
19
  #timeSensor;
20
20
 
21
+ get outlineEditor ()
22
+ {
23
+ const document = require ("../Application/Window");
24
+
25
+ return document .sidebar .outlineEditor;
26
+ }
27
+
21
28
  constructor (editor, element)
22
29
  {
23
30
  super ("Sunrize.AnimationMembersList.");
@@ -105,13 +112,13 @@ module .exports = class AnimationMembersList extends Interface
105
112
  .appendTo (this .#list);
106
113
 
107
114
  const applyButton = $("<span></span>")
108
- .addClass (["apply", "material-icons", "button", "off", "disabled"])
115
+ .addClass (["apply", "material-symbols-outlined", "button", "off", "disabled"])
109
116
  .attr ("title", _("Add keyframe(s)."))
110
117
  .text ("check_box")
111
118
  .on ("click", () => this .addKeyframesToMain ());
112
119
 
113
120
  const removeButton = $("<span></span>")
114
- .addClass (["material-icons-outlined", "button"])
121
+ .addClass (["material-symbols-outlined", "button"])
115
122
  .attr ("title", _("Close animation."))
116
123
  .text ("cancel")
117
124
  .on ("click", () => this .#editor .closeAnimation ());
@@ -126,6 +133,7 @@ module .exports = class AnimationMembersList extends Interface
126
133
  .append (applyButton)
127
134
  .append (document .createTextNode (" "))
128
135
  .append (removeButton)
136
+ .on ("contextmenu", () => this .contextMenuForAnimation (this .#animation))
129
137
  .appendTo (listItem);
130
138
 
131
139
  item
@@ -159,7 +167,7 @@ module .exports = class AnimationMembersList extends Interface
159
167
  .appendTo (this .#list);
160
168
 
161
169
  const applyButton = $("<span></span>")
162
- .addClass (["apply", "material-icons", "button", "off", "disabled"])
170
+ .addClass (["apply", "material-symbols-outlined", "button", "off", "disabled"])
163
171
  .attr ("title", _("Add keyframe(s)."))
164
172
  .text ("check_box")
165
173
  .on ("click", () => this .addKeyframesToNode (node));
@@ -170,7 +178,7 @@ module .exports = class AnimationMembersList extends Interface
170
178
  node .setUserData (this .#animation [_expanded], expanded);
171
179
 
172
180
  const expandButton = $("<span></span>")
173
- .addClass (["material-icons-outlined", "button"])
181
+ .addClass (["material-symbols-outlined", "button"])
174
182
  .addClass (expanded ? "on" : "off")
175
183
  .attr ("title", _("Show all fields."))
176
184
  .text ("expand_circle_down")
@@ -255,7 +263,7 @@ module .exports = class AnimationMembersList extends Interface
255
263
  .text (field .getName ());
256
264
 
257
265
  const applyButton = $("<span></span>")
258
- .addClass (["apply", "material-icons", "button", "off"])
266
+ .addClass (["apply", "material-symbols-outlined", "button", "off"])
259
267
  .attr ("title", _("Add keyframe."))
260
268
  .text ("check_box")
261
269
  .on ("click", () => this .addKeyframeToField (node, field));
@@ -356,13 +364,31 @@ module .exports = class AnimationMembersList extends Interface
356
364
  return offsets;
357
365
  }
358
366
 
367
+ contextMenuForAnimation (node)
368
+ {
369
+ this .#node = node;
370
+
371
+ const menu = [
372
+ {
373
+ label: _("Find Node"),
374
+ args: ["findNode"],
375
+ },
376
+ ];
377
+
378
+ electron .ipcRenderer .send ("context-menu", "animation-members-list", menu);
379
+ }
380
+
359
381
  contextMenuForNode (node)
360
382
  {
361
383
  this .#node = node;
362
384
 
363
385
  const menu = [
364
386
  {
365
- label: _("Remove Member from Animation"),
387
+ label: _("Find Node"),
388
+ args: ["findNode"],
389
+ },
390
+ {
391
+ label: _("Remove Node from Animation"),
366
392
  args: ["removeMember"],
367
393
  },
368
394
  ];
@@ -370,6 +396,11 @@ module .exports = class AnimationMembersList extends Interface
370
396
  electron .ipcRenderer .send ("context-menu", "animation-members-list", menu);
371
397
  }
372
398
 
399
+ findNode ()
400
+ {
401
+ this .outlineEditor .findNode (this .#node);
402
+ }
403
+
373
404
  removeMember ()
374
405
  {
375
406
  this .#editor .removeMembers ([this .#node]);
@@ -105,7 +105,7 @@ module .exports = new class BrowserFrame extends Dialog
105
105
 
106
106
  this .backgroundColor = $("<input></input>")
107
107
  .attr ("title", _("A background color which is applied to the <x3d-canvas> element."))
108
- .attr ("placeholder", "Enter any CSS color here.")
108
+ .attr ("placeholder", "Enter a CSS color here.")
109
109
  .on ("change", () => this .onchange ());
110
110
 
111
111
  $("<tr></tr>")
@@ -113,8 +113,8 @@ module .exports = new class BrowserFrame extends Dialog
113
113
  .append ($("<td></td>") .append (this .backgroundColor))
114
114
  .appendTo (this .table .body);
115
115
 
116
- this .paneObserver = new ResizeObserver (() => this .updateSize ());
117
- this .paneObserver .observe ($("#browser-pane") [0]);
116
+ this .panelObserver = new ResizeObserver (() => this .updateSize ());
117
+ this .panelObserver .observe ($("#browser-panel") [0]);
118
118
 
119
119
  this .frameObserver = new ResizeObserver (() => this .onresize ());
120
120
  this .frameObserver .observe ($("#browser-frame") [0]);
@@ -154,8 +154,10 @@ module .exports = new class BrowserFrame extends Dialog
154
154
 
155
155
  updateSize ()
156
156
  {
157
- this .width .val ($("#browser-pane") .width ());
158
- this .height .val ($("#browser-pane") .height ());
157
+ const frame = $("#browser-frame");
158
+
159
+ this .width .val (frame .innerWidth ());
160
+ this .height .val (frame .innerHeight ());
159
161
  }
160
162
 
161
163
  onchange ()
@@ -189,7 +191,7 @@ module .exports = new class BrowserFrame extends Dialog
189
191
  [numerator = 1, denominator = 1] = configNode ?.getMetaData ("Sunrize/BrowserFrame/aspectRatio") ?? [ ],
190
192
  [backgroundColor = ""] = configNode ?.getMetaData ("Sunrize/BrowserFrame/backgroundColor") ?? [ ],
191
193
  aspectRatio = numerator / denominator,
192
- frameAspectRatio = $("#browser-frame") .width () / $("#browser-frame") .height (),
194
+ frameAspectRatio = $("#browser-frame") .innerWidth () / $("#browser-frame") .innerHeight (),
193
195
  element = $(this .browser .element);
194
196
 
195
197
  if (fixedSize && aspectRatio)
@@ -211,9 +213,14 @@ module .exports = new class BrowserFrame extends Dialog
211
213
 
212
214
  onsize ()
213
215
  {
214
- const document = require ("../Application/Window");
215
-
216
- document .verticalSplitter .position = this .width .val () / $("body") .width ();
217
- document .horizontalSplitter .position = this .height .val () / $("body") .height ();
216
+ const
217
+ document = require ("../Application/Window"),
218
+ xOffset = $("#browser-panel") .outerWidth () - $("#browser-frame") .innerWidth (),
219
+ yOffset = $("#browser-panel") .outerHeight () - $("#browser-frame") .innerHeight (),
220
+ width = parseInt (this .width .val ()),
221
+ height = parseInt (this .height .val ());
222
+
223
+ document .verticalSplitter .position = (width + xOffset) / $("body") .width ();
224
+ document .horizontalSplitter .position = (height + yOffset) / $("body") .height ();
218
225
  }
219
226
  };
@@ -16,16 +16,14 @@ module .exports = class Console extends Interface
16
16
  {
17
17
  super (`Sunrize.Console.${element .attr ("id")}.`);
18
18
 
19
+ this .console = element;
19
20
  this .suspendConsole = false;
20
21
  this .historyIndex = 0;
21
22
  this .history = [ ];
22
23
  this .addMessageCallback = this .addMessage .bind (this);
23
24
 
24
- this .console = element;
25
- this .left = $("<div></div>") .addClass ("console-left") .appendTo (this .console);
26
-
27
- this .toolbar = $("<div></div>")
28
- .addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "console-toolbar"])
25
+ this .left = $("<div></div>")
26
+ .addClass ("console-left")
29
27
  .appendTo (this .console);
30
28
 
31
29
  this .output = $("<div></div>")
@@ -87,9 +85,12 @@ module .exports = class Console extends Interface
87
85
 
88
86
  // Toolbar
89
87
 
88
+ this .toolbar = $("<div></div>")
89
+ .addClass (["toolbar", "vertical-toolbar", "secondary-toolbar", "console-toolbar"])
90
+ .appendTo (this .console);
91
+
90
92
  this .searchButton = $("<span></span>")
91
- .addClass ("material-icons")
92
- .css ("transform", "scale(1.2)")
93
+ .addClass ("material-symbols-outlined")
93
94
  .attr ("title", _("Show search widget."))
94
95
  .text ("search")
95
96
  .on ("click", () => this .toggleSearch (!this .config .file .search))
@@ -98,21 +99,21 @@ module .exports = class Console extends Interface
98
99
  $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
99
100
 
100
101
  this .suspendButton = $("<span></span>")
101
- .addClass ("material-icons")
102
+ .addClass ("material-symbols-outlined")
103
+ .css ("scale", "0.8")
102
104
  .attr ("title", _("Suspend console output."))
103
105
  .text ("pause_circle")
104
106
  .on ("click", () => this .setSuspendConsole (!this .suspendConsole))
105
107
  .appendTo (this .toolbar);
106
108
 
107
109
  this .clearButton = $("<span></span>")
108
- .addClass ("material-icons")
110
+ .addClass ("material-symbols-outlined")
111
+ .css ("scale", "0.8")
109
112
  .attr ("title", _("Clear console."))
110
113
  .text ("delete_forever")
111
114
  .on ("click", () => this .clearConsole ())
112
115
  .appendTo (this .toolbar);
113
116
 
114
- $("<span></span>") .addClass ("separator") .appendTo (this .toolbar);
115
-
116
117
  // Input
117
118
 
118
119
  this .textarea = $("<textarea></textarea>")
@@ -437,10 +438,7 @@ module .exports = class Console extends Interface
437
438
  element .addClass ("selected");
438
439
 
439
440
  if (scroll)
440
- {
441
441
  element .get (0) .scrollIntoView ({ block: "center", inline: "start", behavior: "smooth" });
442
- $(window) .scrollTop (0);
443
- }
444
442
 
445
443
  this .searchStatus .text (util .format (_("%d of %d"), this .currentElement + 1, this .foundElements .length));
446
444
  this .searchPreviousButton .removeClass ("disabled");
@@ -2,6 +2,7 @@
2
2
 
3
3
  const
4
4
  $ = require ("jquery"),
5
+ electron = require ("electron"),
5
6
  X3D = require ("../X3D"),
6
7
  Interface = require ("../Application/Interface"),
7
8
  Traverse = require ("x3d-traverse"),
@@ -9,6 +10,13 @@ const
9
10
 
10
11
  module .exports = class NodeList extends Interface
11
12
  {
13
+ get outlineEditor ()
14
+ {
15
+ const document = require ("../Application/Window");
16
+
17
+ return document .sidebar .outlineEditor;
18
+ }
19
+
12
20
  constructor (element, { filter = () => true, callback = Function .prototype })
13
21
  {
14
22
  super ("Sunrize.NodeList.");
@@ -21,6 +29,8 @@ module .exports = class NodeList extends Interface
21
29
  this .node = null;
22
30
  this .nodes = [ ];
23
31
 
32
+ electron .ipcRenderer .on ("node-list", (event, key, ... args) => this [key] (... args));
33
+
24
34
  this .setup ();
25
35
  }
26
36
 
@@ -72,6 +82,7 @@ module .exports = class NodeList extends Interface
72
82
  .append (document .createTextNode (" "))
73
83
  .append (nameElement)
74
84
  .on ("click", () => this .setNode (node))
85
+ .on ("contextmenu", () => this .showContextMenu (node))
75
86
  .appendTo (listItem);
76
87
 
77
88
  node .typeName_changed .addInterest ("set_typeName", this, typeNameElement, node);
@@ -124,4 +135,28 @@ module .exports = class NodeList extends Interface
124
135
  {
125
136
  element .text (this .getName (node));
126
137
  }
138
+
139
+ #node;
140
+
141
+ showContextMenu (node)
142
+ {
143
+ this .#node = node;
144
+
145
+ const menu = [
146
+ {
147
+ label: _("Find Node"),
148
+ args: ["findNode", this .id],
149
+ },
150
+ ];
151
+
152
+ electron .ipcRenderer .send ("context-menu", "node-list", menu);
153
+ }
154
+
155
+ findNode (id)
156
+ {
157
+ if (id !== this .id)
158
+ return;
159
+
160
+ this .outlineEditor .findNode (this .#node);
161
+ }
127
162
  };