sunrize 2.4.0 → 2.5.0
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.
- package/package.json +7 -7
- package/src/Application/Application.js +21 -2
- package/src/Application/Dashboard.js +21 -19
- package/src/Application/DataStorage.js +10 -37
- package/src/Application/Document.js +149 -22
- package/src/Application/Footer.js +62 -16
- package/src/Application/Hierarchy.js +1 -1
- package/src/Application/Interface.js +1 -1
- package/src/Application/Sidebar.js +12 -9
- package/src/Application/Tabs.js +79 -11
- package/src/Controls/Splitter.js +146 -19
- package/src/Controls/Tabs.js +17 -12
- package/src/Editors/AnimationEditor.js +203 -194
- package/src/Editors/AnimationMemberList.js +37 -6
- package/src/Editors/BrowserFrame.js +17 -10
- package/src/Editors/Console.js +9 -13
- package/src/Editors/MediaRecorder.js +27 -0
- package/src/Editors/NodeList.js +35 -0
- package/src/Editors/OutlineEditor.js +20 -20
- package/src/Editors/OutlineView.js +85 -61
- package/src/Editors/Panel.js +6 -3
- package/src/Editors/RouteGraph.js +72 -102
- package/src/Editors/SceneProperties.js +4 -4
- package/src/Editors/ScriptEditor.js +37 -23
- package/src/Tools/Core/X3DBaseTool.js +11 -10
- package/src/Tools/Core/X3DImportedNodeInstanceTool.js +52 -0
- package/src/Tools/Core/X3DPrototypeInstanceTool.js +6 -6
- package/src/Tools/Grids/GridTool.js +6 -2
- package/src/Tools/Grids/X3DGridNodeTool.js +1 -1
- package/src/Tools.js +0 -3
- package/src/Undo/Editor.js +19 -16
- package/src/Undo/UndoManager.js +1 -1
- package/src/assets/fonts/Roboto/OFL.txt +93 -0
- package/src/assets/fonts/Roboto/README.txt +118 -0
- package/src/assets/fonts/Roboto/Roboto-Italic-VariableFont_wdth,wght.ttf +0 -0
- package/src/assets/fonts/Roboto/Roboto-VariableFont_wdth,wght.ttf +0 -0
- package/src/assets/fonts/Roboto_Mono/OFL.txt +93 -0
- package/src/assets/fonts/Roboto_Mono/README.txt +77 -0
- package/src/assets/fonts/Roboto_Mono/RobotoMono-Italic-VariableFont_wght.ttf +0 -0
- package/src/assets/fonts/Roboto_Mono/RobotoMono-VariableFont_wght.ttf +0 -0
- package/src/assets/html/application.html +34 -9
- package/src/assets/html/window.html +6 -7
- package/src/assets/themes/default.css +133 -156
- package/src/assets/themes/{system-colors.css → definitions.css} +50 -7
- package/src/assets/themes/media-template.css +3 -2
- package/src/assets/themes/media.css +3 -2
- package/src/assets/themes/prompt-template.css +4 -1
- package/src/assets/themes/prompt.css +4 -1
- package/src/assets/html/application-template.html +0 -164
- 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 .
|
|
66
|
-
.attr ("id", "animation-editor-
|
|
67
|
-
.addClass (["animation-editor-
|
|
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 .
|
|
75
|
+
.appendTo (this .controls)
|
|
75
76
|
.on ("click", () => this .createAnimation ());
|
|
76
77
|
|
|
77
|
-
$("<span></span>") .addClass ("separator") .appendTo (this .
|
|
78
|
+
$("<span></span>") .addClass ("separator") .appendTo (this .controls);
|
|
78
79
|
|
|
79
80
|
this .addMembersIcon = $("<span></span>")
|
|
80
|
-
.addClass ("material-
|
|
81
|
+
.addClass ("material-symbols-outlined")
|
|
81
82
|
.attr ("title", _("Add member(s) to animation."))
|
|
82
83
|
.text ("add")
|
|
83
|
-
.appendTo (this .
|
|
84
|
+
.appendTo (this .controls)
|
|
84
85
|
.on ("click", () => this .addMembers ());
|
|
85
86
|
|
|
86
|
-
$("<span></span>") .addClass ("separator") .appendTo (this .
|
|
87
|
+
$("<span></span>") .addClass ("separator") .appendTo (this .controls);
|
|
87
88
|
|
|
88
89
|
this .cutFrameIcon = $("<span></span>")
|
|
89
|
-
.addClass ("material-
|
|
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 .
|
|
96
|
+
.appendTo (this .controls)
|
|
95
97
|
.on ("click", () => this .cutKeyframes ());
|
|
96
98
|
|
|
97
99
|
this .copyFrameIcon = $("<span></span>")
|
|
98
|
-
.addClass ("material-
|
|
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 .
|
|
106
|
+
.appendTo (this .controls)
|
|
104
107
|
.on ("click", () => this .copyKeyframes ());
|
|
105
108
|
|
|
106
109
|
this .pasteFrameIcon = $("<span></span>")
|
|
107
|
-
.addClass ("material-
|
|
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 .
|
|
116
|
+
.appendTo (this .controls)
|
|
113
117
|
.on ("click", () => this .pasteKeyframes ());
|
|
114
118
|
|
|
115
|
-
$("<span></span>") .addClass ("separator") .appendTo (this .
|
|
119
|
+
$("<span></span>") .addClass ("separator") .appendTo (this .controls);
|
|
116
120
|
|
|
117
121
|
this .firstFrameIcon = $("<span></span>")
|
|
118
|
-
.addClass ("material-
|
|
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 .
|
|
126
|
+
.appendTo (this .controls)
|
|
122
127
|
.on ("click", () => this .firstFrame ());
|
|
123
128
|
|
|
124
129
|
this .toggleAnimationIcon = $("<span></span>")
|
|
125
|
-
.addClass ("material-
|
|
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 .
|
|
134
|
+
.appendTo (this .controls)
|
|
129
135
|
.on ("click", () => this .toggleAnimation ());
|
|
130
136
|
|
|
131
137
|
this .lastFrameIcon = $("<span></span>")
|
|
132
|
-
.addClass ("material-
|
|
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 .
|
|
142
|
+
.appendTo (this .controls)
|
|
136
143
|
.on ("click", () => this .lastFrame ());
|
|
137
144
|
|
|
138
145
|
this .loopIcon = $("<span></span>")
|
|
139
|
-
.addClass ("material-
|
|
146
|
+
.addClass ("material-symbols-outlined")
|
|
147
|
+
.css ("scale", "0.7")
|
|
140
148
|
.attr ("title", _("Loop animation."))
|
|
141
|
-
.text ("
|
|
142
|
-
.appendTo (this .
|
|
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
|
-
.
|
|
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-
|
|
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 .
|
|
169
|
+
.appendTo (this .controls)
|
|
161
170
|
.on ("click", () => this .showProperties ());
|
|
162
171
|
|
|
163
|
-
$("<span></span>") .addClass ("separator") .appendTo (this .
|
|
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 .
|
|
183
|
+
.appendTo (this .controls)
|
|
174
184
|
.on ("change", () => this .setKeyType ());
|
|
175
185
|
|
|
176
186
|
this .timeElement = $("<span></span>")
|
|
177
|
-
.addClass (
|
|
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 .
|
|
191
|
+
.appendTo (this .controls);
|
|
183
192
|
|
|
184
193
|
// Navigation toolbar
|
|
185
194
|
|
|
186
|
-
this .
|
|
187
|
-
.attr ("id", "animation-editor-
|
|
188
|
-
.addClass (["animation-editor-
|
|
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-
|
|
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 .
|
|
204
|
+
.appendTo (this .toolbar)
|
|
198
205
|
.on ("click", () => this .zoomOut ());
|
|
199
206
|
|
|
200
207
|
this .zoomInIcon = $("<span></span>")
|
|
201
|
-
.addClass ("material-
|
|
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 .
|
|
211
|
+
.appendTo (this .toolbar)
|
|
207
212
|
.on ("click", () => this .zoomIn ());
|
|
208
213
|
|
|
209
214
|
this .zoomFitIcon = $("<span></span>")
|
|
210
|
-
.addClass ("material-
|
|
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 .
|
|
218
|
+
.appendTo (this .toolbar)
|
|
216
219
|
.on ("click", () => this .zoomFit ());
|
|
217
220
|
|
|
218
221
|
this .zoom100Icon = $("<span></span>")
|
|
219
|
-
.addClass ("material-
|
|
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 .
|
|
225
|
+
.appendTo (this .toolbar)
|
|
225
226
|
.on ("click", () => this .zoom100 ());
|
|
226
227
|
|
|
227
228
|
// Animations List
|
|
@@ -416,7 +417,6 @@ module .exports = class AnimationEditor extends Interface
|
|
|
416
417
|
|
|
417
418
|
this .setSelection (require ("../Application/Selection"));
|
|
418
419
|
this .zoomFit ();
|
|
419
|
-
this .resizeTimeline ();
|
|
420
420
|
this .requestDrawTimeline ();
|
|
421
421
|
|
|
422
422
|
this .browser .nextFrame () .then (() => this .setCurrentFrame (0));
|
|
@@ -730,12 +730,9 @@ module .exports = class AnimationEditor extends Interface
|
|
|
730
730
|
|
|
731
731
|
for (const route of interpolator ._value_changed .getOutputRoutes ())
|
|
732
732
|
{
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
continue;
|
|
737
|
-
|
|
738
|
-
const field = node .getField (route .getDestinationField ());
|
|
733
|
+
const
|
|
734
|
+
node = route .getDestinationNode (),
|
|
735
|
+
field = node .getField (route .getDestinationField ());
|
|
739
736
|
|
|
740
737
|
this .members .add (node);
|
|
741
738
|
this .fields .set (field, interpolator);
|
|
@@ -2341,6 +2338,9 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2341
2338
|
|
|
2342
2339
|
on_mousedown (event)
|
|
2343
2340
|
{
|
|
2341
|
+
if (!this .animation)
|
|
2342
|
+
return;
|
|
2343
|
+
|
|
2344
2344
|
$(document)
|
|
2345
2345
|
.on ("mousemove.AnimationEditor", event => this .updatePointer (event))
|
|
2346
2346
|
.on ("mouseup.AnimationEditor", event => this .on_mouseup (event))
|
|
@@ -2405,6 +2405,9 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2405
2405
|
|
|
2406
2406
|
on_mouseup (event)
|
|
2407
2407
|
{
|
|
2408
|
+
if (!this .animation)
|
|
2409
|
+
return;
|
|
2410
|
+
|
|
2408
2411
|
$(document) .off (".AnimationEditor");
|
|
2409
2412
|
|
|
2410
2413
|
this .updatePointer (event);
|
|
@@ -2421,6 +2424,9 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2421
2424
|
|
|
2422
2425
|
on_mousemove (event)
|
|
2423
2426
|
{
|
|
2427
|
+
if (!this .animation)
|
|
2428
|
+
return;
|
|
2429
|
+
|
|
2424
2430
|
switch (this .#button)
|
|
2425
2431
|
{
|
|
2426
2432
|
case undefined:
|
|
@@ -2440,6 +2446,9 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2440
2446
|
|
|
2441
2447
|
on_wheel (event)
|
|
2442
2448
|
{
|
|
2449
|
+
if (!this .animation)
|
|
2450
|
+
return;
|
|
2451
|
+
|
|
2443
2452
|
const deltaY = event .originalEvent .deltaY;
|
|
2444
2453
|
|
|
2445
2454
|
this .updatePointer (event);
|
|
@@ -2859,190 +2868,190 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2859
2868
|
context .scale (contentScale, contentScale);
|
|
2860
2869
|
context .clearRect (0, 0, tracksWidth, tracksHeight);
|
|
2861
2870
|
|
|
2862
|
-
if (
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
lastFrame = Math .min (this .getDuration (), Math .ceil ((width - translation) / scale)) + 1;
|
|
2873
|
-
|
|
2874
|
-
const [frameStep, frameFactor] = this .getFrameParams ();
|
|
2875
|
-
|
|
2876
|
-
const
|
|
2877
|
-
blue = this .#style .getPropertyValue ("--system-blue"),
|
|
2878
|
-
indigo = this .#style .getPropertyValue ("--system-indigo"),
|
|
2879
|
-
orange = this .#style .getPropertyValue ("--system-orange"),
|
|
2880
|
-
brown = this .#style .getPropertyValue ("--system-brown"),
|
|
2881
|
-
red = this .#style .getPropertyValue ("--system-red"),
|
|
2882
|
-
range = this .#style .getPropertyValue ("--selection-range"),
|
|
2883
|
-
tint1 = this .#style .getPropertyValue ("--tint-color1"),
|
|
2884
|
-
tint2 = this .#style .getPropertyValue ("--tint-color2");
|
|
2871
|
+
if (this .animation)
|
|
2872
|
+
{
|
|
2873
|
+
const
|
|
2874
|
+
left = this .getLeft (),
|
|
2875
|
+
width = this .getWidth (),
|
|
2876
|
+
translation = this .getTranslation (),
|
|
2877
|
+
scale = this .getScale (),
|
|
2878
|
+
trackOffsets = this .memberList .getTrackOffsets (),
|
|
2879
|
+
firstFrame = Math .max (0, Math .floor (-translation / scale)),
|
|
2880
|
+
lastFrame = Math .min (this .getDuration (), Math .ceil ((width - translation) / scale)) + 1;
|
|
2885
2881
|
|
|
2886
|
-
|
|
2882
|
+
const [frameStep, frameFactor] = this .getFrameParams ();
|
|
2887
2883
|
|
|
2888
|
-
|
|
2889
|
-
|
|
2884
|
+
const
|
|
2885
|
+
blue = this .#style .getPropertyValue ("--system-blue"),
|
|
2886
|
+
indigo = this .#style .getPropertyValue ("--system-indigo"),
|
|
2887
|
+
orange = this .#style .getPropertyValue ("--system-orange"),
|
|
2888
|
+
brown = this .#style .getPropertyValue ("--system-brown"),
|
|
2889
|
+
red = this .#style .getPropertyValue ("--system-red"),
|
|
2890
|
+
range = this .#style .getPropertyValue ("--selection-range"),
|
|
2891
|
+
tint1 = this .#style .getPropertyValue ("--tint-color1"),
|
|
2892
|
+
tint2 = this .#style .getPropertyValue ("--tint-color2");
|
|
2890
2893
|
|
|
2891
|
-
|
|
2894
|
+
// Draw selection range.
|
|
2892
2895
|
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
const minFrame = X3D .Algorithm .clamp (selectionRange [0], firstFrame, lastFrame - 1);
|
|
2896
|
-
const maxFrame = X3D .Algorithm .clamp (selectionRange [1], firstFrame, lastFrame - 1);
|
|
2897
|
-
const x0 = left + minFrame * scale + translation;
|
|
2898
|
-
const x1 = left + maxFrame * scale + translation;
|
|
2896
|
+
context .save ();
|
|
2897
|
+
context .clip (this .timelineClip);
|
|
2899
2898
|
|
|
2900
|
-
|
|
2899
|
+
const selectionRange = this .getSelectionRange ();
|
|
2901
2900
|
|
|
2902
|
-
|
|
2903
|
-
|
|
2901
|
+
if (selectionRange [0] !== selectionRange [1])
|
|
2902
|
+
{
|
|
2903
|
+
const minFrame = X3D .Algorithm .clamp (selectionRange [0], firstFrame, lastFrame - 1);
|
|
2904
|
+
const maxFrame = X3D .Algorithm .clamp (selectionRange [1], firstFrame, lastFrame - 1);
|
|
2905
|
+
const x0 = left + minFrame * scale + translation;
|
|
2906
|
+
const x1 = left + maxFrame * scale + translation;
|
|
2904
2907
|
|
|
2905
|
-
|
|
2908
|
+
context .fillStyle = range;
|
|
2906
2909
|
|
|
2907
|
-
|
|
2910
|
+
context .fillRect (Math .min (x0, x1) - 1, 0, Math .abs (x1 - x0) + 3, tracksHeight);
|
|
2911
|
+
}
|
|
2908
2912
|
|
|
2909
|
-
|
|
2910
|
-
{
|
|
2911
|
-
// Track
|
|
2913
|
+
context .restore ();
|
|
2912
2914
|
|
|
2913
|
-
|
|
2915
|
+
// Draw all tracks.
|
|
2914
2916
|
|
|
2915
|
-
|
|
2917
|
+
for (const [i, { item, top, bottom, height }] of trackOffsets .entries ())
|
|
2916
2918
|
{
|
|
2917
|
-
//
|
|
2919
|
+
// Track
|
|
2918
2920
|
|
|
2919
|
-
|
|
2921
|
+
const odd = item .data ("i") % 2;
|
|
2922
|
+
|
|
2923
|
+
if (odd || i === 0)
|
|
2920
2924
|
{
|
|
2921
|
-
|
|
2925
|
+
// Draw a line below last field.
|
|
2922
2926
|
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
else if (item .hasClass ("field"))
|
|
2927
|
-
{
|
|
2928
|
-
// Draw a bar.
|
|
2927
|
+
if (trackOffsets [i + 1] ?.item .hasClass ("node") ?? true)
|
|
2928
|
+
{
|
|
2929
|
+
context .fillStyle = tint2;
|
|
2929
2930
|
|
|
2930
|
-
|
|
2931
|
+
context .fillRect (0, bottom - 1, tracksWidth, 1);
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
else if (item .hasClass ("field"))
|
|
2935
|
+
{
|
|
2936
|
+
// Draw a bar.
|
|
2931
2937
|
|
|
2932
|
-
|
|
2933
|
-
}
|
|
2938
|
+
context .fillStyle = tint1;
|
|
2934
2939
|
|
|
2935
|
-
|
|
2940
|
+
context .fillRect (0, top, tracksWidth, height);
|
|
2941
|
+
}
|
|
2936
2942
|
|
|
2937
|
-
|
|
2943
|
+
// Highlight track on hover.
|
|
2938
2944
|
|
|
2939
|
-
|
|
2940
|
-
item .addClass ("hover-track");
|
|
2941
|
-
else
|
|
2942
|
-
item .removeClass ("hover-track");
|
|
2945
|
+
const hover = this .pointer .y > top && this .pointer .y < bottom;
|
|
2943
2946
|
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
+
if (hover)
|
|
2948
|
+
item .addClass ("hover-track");
|
|
2949
|
+
else
|
|
2950
|
+
item .removeClass ("hover-track");
|
|
2947
2951
|
|
|
2948
|
-
|
|
2949
|
-
|
|
2952
|
+
if (item .is (".hover, .hover-tracks") || hover)
|
|
2953
|
+
{
|
|
2954
|
+
context .fillStyle = tint2;
|
|
2950
2955
|
|
|
2951
|
-
|
|
2956
|
+
context .fillRect (0, top, tracksWidth, height);
|
|
2957
|
+
}
|
|
2952
2958
|
|
|
2953
|
-
|
|
2954
|
-
context .clip (this .timelineClip);
|
|
2959
|
+
// Frames
|
|
2955
2960
|
|
|
2956
|
-
|
|
2961
|
+
context .save ();
|
|
2962
|
+
context .clip (this .timelineClip);
|
|
2957
2963
|
|
|
2958
|
-
|
|
2959
|
-
context .lineWidth = item .is (".main, .node") ? 3 : 1;
|
|
2964
|
+
// Draw vertical lines.
|
|
2960
2965
|
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
const s = frame % frameFactor; // size (large or small)
|
|
2964
|
-
const y = Math .floor (top + height * (s ? 0.75 : 0.5));
|
|
2965
|
-
const x = Math .floor (left + this .getPointerFromFrame (frame));
|
|
2966
|
+
context .strokeStyle = item .hasClass ("main") ? indigo : blue;
|
|
2967
|
+
context .lineWidth = item .is (".main, .node") ? 3 : 1;
|
|
2966
2968
|
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2969
|
+
for (let frame = firstFrame - (firstFrame % frameStep); frame < lastFrame; frame += frameStep)
|
|
2970
|
+
{
|
|
2971
|
+
const s = frame % frameFactor; // size (large or small)
|
|
2972
|
+
const y = Math .floor (top + height * (s ? 0.75 : 0.5));
|
|
2973
|
+
const x = Math .floor (left + this .getPointerFromFrame (frame));
|
|
2974
|
+
|
|
2975
|
+
context .beginPath ();
|
|
2976
|
+
context .moveTo (x + 0.5, y - this .TRACK_PADDING);
|
|
2977
|
+
context .lineTo (x + 0.5, bottom - this .TRACK_PADDING);
|
|
2978
|
+
context .stroke ();
|
|
2979
|
+
}
|
|
2972
2980
|
|
|
2973
|
-
|
|
2981
|
+
// Draw keyframes.
|
|
2974
2982
|
|
|
2975
|
-
|
|
2976
|
-
{
|
|
2977
|
-
case "main":
|
|
2983
|
+
switch (item .attr ("type"))
|
|
2978
2984
|
{
|
|
2979
|
-
|
|
2980
|
-
|
|
2985
|
+
case "main":
|
|
2986
|
+
{
|
|
2987
|
+
for (const field of this .fields .keys ())
|
|
2988
|
+
this .drawKeyframes (context, field, firstFrame, lastFrame, bottom - this .TRACK_PADDING, brown);
|
|
2981
2989
|
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2990
|
+
break;
|
|
2991
|
+
}
|
|
2992
|
+
case "node":
|
|
2993
|
+
{
|
|
2994
|
+
const node = item .data ("node");
|
|
2987
2995
|
|
|
2988
|
-
|
|
2989
|
-
|
|
2996
|
+
for (const field of node .getFields ())
|
|
2997
|
+
this .drawKeyframes (context, field, firstFrame, lastFrame, bottom - this .TRACK_PADDING, brown);
|
|
2990
2998
|
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2999
|
+
break;
|
|
3000
|
+
}
|
|
3001
|
+
case "field":
|
|
3002
|
+
{
|
|
3003
|
+
this .drawKeyframes (context, item .data ("field"), firstFrame, lastFrame, bottom - this .TRACK_PADDING, orange);
|
|
3004
|
+
break;
|
|
3005
|
+
}
|
|
2997
3006
|
}
|
|
2998
|
-
}
|
|
2999
3007
|
|
|
3000
|
-
|
|
3008
|
+
// Draw selected keyframes.
|
|
3001
3009
|
|
|
3002
|
-
|
|
3003
|
-
{
|
|
3004
|
-
case "main":
|
|
3010
|
+
switch (item .attr ("type"))
|
|
3005
3011
|
{
|
|
3006
|
-
|
|
3012
|
+
case "main":
|
|
3013
|
+
{
|
|
3014
|
+
const fields = new Set (this .fields .keys ());
|
|
3007
3015
|
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
+
this .drawSelectedKeyframes (context, fields, bottom - this .TRACK_PADDING, red);
|
|
3017
|
+
break;
|
|
3018
|
+
}
|
|
3019
|
+
case "node":
|
|
3020
|
+
{
|
|
3021
|
+
const
|
|
3022
|
+
node = item .data ("node"),
|
|
3023
|
+
fields = new Set (node .getFields ());
|
|
3016
3024
|
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3025
|
+
this .drawSelectedKeyframes (context, fields, bottom - this .TRACK_PADDING, red);
|
|
3026
|
+
break;
|
|
3027
|
+
}
|
|
3028
|
+
case "field":
|
|
3029
|
+
{
|
|
3030
|
+
const fields = new Set ([item .data ("field")]);
|
|
3023
3031
|
|
|
3024
|
-
|
|
3025
|
-
|
|
3032
|
+
this .drawSelectedKeyframes (context, fields, bottom - this .TRACK_PADDING, red);
|
|
3033
|
+
break;
|
|
3034
|
+
}
|
|
3026
3035
|
}
|
|
3027
|
-
}
|
|
3028
3036
|
|
|
3029
|
-
|
|
3030
|
-
|
|
3037
|
+
context .restore ();
|
|
3038
|
+
}
|
|
3031
3039
|
|
|
3032
|
-
|
|
3040
|
+
// Draw current frame cursor.
|
|
3033
3041
|
|
|
3034
|
-
|
|
3035
|
-
|
|
3042
|
+
context .save ();
|
|
3043
|
+
context .clip (this .timelineClip);
|
|
3036
3044
|
|
|
3037
|
-
|
|
3038
|
-
|
|
3045
|
+
const frame = this .getCurrentFrame ();
|
|
3046
|
+
const x = Math .floor (left + this .getPointerFromFrame (frame));
|
|
3039
3047
|
|
|
3040
|
-
|
|
3048
|
+
context .fillStyle = blue;
|
|
3041
3049
|
|
|
3042
|
-
|
|
3050
|
+
context .fillRect (x - 1, 0, 3, tracksHeight);
|
|
3051
|
+
context .restore ();
|
|
3052
|
+
}
|
|
3043
3053
|
|
|
3044
3054
|
context .restore ();
|
|
3045
|
-
context .restore ();
|
|
3046
3055
|
}
|
|
3047
3056
|
|
|
3048
3057
|
#defaultIntegers = new X3D .MFInt32 ();
|