sunrize 2.3.5 → 2.4.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.
- package/package.json +13 -13
- package/src/Application/Application.js +3 -3
- package/src/Application/Document.js +1 -1
- package/src/Application/Footer.js +10 -5
- package/src/Application/Tabs.js +13 -5
- package/src/Bits/X3DUOM.js +0 -3
- package/src/Controls/Tabs.js +4 -3
- package/src/Editors/AnimationEditor.js +193 -180
- package/src/Editors/OutlineEditor.js +51 -55
- package/src/Editors/OutlineView.js +89 -53
- package/src/Editors/RouteGraph.js +2381 -0
- package/src/Tools/Grids/GridTool.js +6 -2
- package/src/Tools/Grids/X3DGridNodeTool.js +1 -1
- package/src/Tools/Rendering/X3DGeometryNodeTool.js +2 -3
- package/src/Tools/Text/TextTool.js +1 -14
- package/src/Tools.js +3 -0
- package/src/Undo/Editor.js +39 -10
- package/src/Undo/UndoManager.js +18 -7
- package/src/assets/X3DUOM.xml +11 -9
- package/src/assets/html/application-template.html +1 -1
- package/src/assets/html/application.html +1 -1
- package/src/assets/themes/default.css +361 -37
- package/src/assets/themes/system-colors.css +17 -3
|
@@ -16,10 +16,14 @@ require ("../Bits/Validate");
|
|
|
16
16
|
|
|
17
17
|
module .exports = class AnimationEditor extends Interface
|
|
18
18
|
{
|
|
19
|
+
#style = window .getComputedStyle ($("#animation-editor") [0]);
|
|
20
|
+
|
|
19
21
|
constructor (element)
|
|
20
22
|
{
|
|
21
23
|
super (`Sunrize.AnimationEditor.${element .attr ("id")}.`);
|
|
22
24
|
|
|
25
|
+
const darwin = process .platform === "darwin";
|
|
26
|
+
|
|
23
27
|
this .animationEditor = element;
|
|
24
28
|
|
|
25
29
|
this .verticalSplitter = $("<div></div>")
|
|
@@ -83,21 +87,27 @@ module .exports = class AnimationEditor extends Interface
|
|
|
83
87
|
|
|
84
88
|
this .cutFrameIcon = $("<span></span>")
|
|
85
89
|
.addClass ("material-icons")
|
|
86
|
-
.attr ("title",
|
|
90
|
+
.attr ("title", darwin
|
|
91
|
+
? _("Cut selected keyframes. (⌘X)")
|
|
92
|
+
: _("Cut selected keyframes. (Ctrl+X)"))
|
|
87
93
|
.text ("content_cut")
|
|
88
94
|
.appendTo (this .toolbar)
|
|
89
95
|
.on ("click", () => this .cutKeyframes ());
|
|
90
96
|
|
|
91
97
|
this .copyFrameIcon = $("<span></span>")
|
|
92
98
|
.addClass ("material-icons")
|
|
93
|
-
.attr ("title",
|
|
99
|
+
.attr ("title", darwin
|
|
100
|
+
? _("Copy selected keyframes. (⌘C)")
|
|
101
|
+
: _("Copy selected keyframes. (Ctrl+C)"))
|
|
94
102
|
.text ("content_copy")
|
|
95
103
|
.appendTo (this .toolbar)
|
|
96
104
|
.on ("click", () => this .copyKeyframes ());
|
|
97
105
|
|
|
98
106
|
this .pasteFrameIcon = $("<span></span>")
|
|
99
107
|
.addClass ("material-icons")
|
|
100
|
-
.attr ("title",
|
|
108
|
+
.attr ("title", darwin
|
|
109
|
+
? _("Paste keyframes at current frame. (⌘V)")
|
|
110
|
+
: _("Paste keyframes at current frame. (Ctrl+V)"))
|
|
101
111
|
.text ("content_paste")
|
|
102
112
|
.appendTo (this .toolbar)
|
|
103
113
|
.on ("click", () => this .pasteKeyframes ());
|
|
@@ -113,7 +123,7 @@ module .exports = class AnimationEditor extends Interface
|
|
|
113
123
|
|
|
114
124
|
this .toggleAnimationIcon = $("<span></span>")
|
|
115
125
|
.addClass ("material-icons")
|
|
116
|
-
.attr ("title", _("Start animation."))
|
|
126
|
+
.attr ("title", _("Start animation. (Space)"))
|
|
117
127
|
.text ("play_arrow")
|
|
118
128
|
.appendTo (this .toolbar)
|
|
119
129
|
.on ("click", () => this .toggleAnimation ());
|
|
@@ -180,8 +190,8 @@ module .exports = class AnimationEditor extends Interface
|
|
|
180
190
|
|
|
181
191
|
this .zoomOutIcon = $("<span></span>")
|
|
182
192
|
.addClass ("material-icons")
|
|
183
|
-
.attr ("title", _("Zoom timeline out."))
|
|
184
|
-
.css ("transform", "scale(1.
|
|
193
|
+
.attr ("title", _("Zoom timeline out. (-)"))
|
|
194
|
+
.css ("transform", "scale(1.5)")
|
|
185
195
|
.css ("margin-bottom", "15px")
|
|
186
196
|
.text ("zoom_out")
|
|
187
197
|
.appendTo (this .navigation)
|
|
@@ -189,8 +199,8 @@ module .exports = class AnimationEditor extends Interface
|
|
|
189
199
|
|
|
190
200
|
this .zoomInIcon = $("<span></span>")
|
|
191
201
|
.addClass ("material-icons")
|
|
192
|
-
.attr ("title", _("Zoom timeline in."))
|
|
193
|
-
.css ("transform", "scale(1.
|
|
202
|
+
.attr ("title", _("Zoom timeline in. (+)"))
|
|
203
|
+
.css ("transform", "scale(1.5)")
|
|
194
204
|
.css ("margin-bottom", "15px")
|
|
195
205
|
.text ("zoom_in")
|
|
196
206
|
.appendTo (this .navigation)
|
|
@@ -198,7 +208,7 @@ module .exports = class AnimationEditor extends Interface
|
|
|
198
208
|
|
|
199
209
|
this .zoomFitIcon = $("<span></span>")
|
|
200
210
|
.addClass ("material-icons")
|
|
201
|
-
.attr ("title", _("Zoom timeline to fit in window."))
|
|
211
|
+
.attr ("title", _("Zoom timeline to fit in window. (0)"))
|
|
202
212
|
.css ("transform", "scale(1.4)")
|
|
203
213
|
.css ("margin-bottom", "15px")
|
|
204
214
|
.text ("fit_screen")
|
|
@@ -207,7 +217,7 @@ module .exports = class AnimationEditor extends Interface
|
|
|
207
217
|
|
|
208
218
|
this .zoom100Icon = $("<span></span>")
|
|
209
219
|
.addClass ("material-icons")
|
|
210
|
-
.attr ("title", _("Default timeline zoom."))
|
|
220
|
+
.attr ("title", _("Default timeline zoom. (1)"))
|
|
211
221
|
.css ("transform", "scale(1.4)")
|
|
212
222
|
.css ("margin-bottom", "15px")
|
|
213
223
|
.text ("1x_mobiledata")
|
|
@@ -513,7 +523,7 @@ module .exports = class AnimationEditor extends Interface
|
|
|
513
523
|
Editor .undoManager .endUndo ();
|
|
514
524
|
|
|
515
525
|
// Wait until NodeList knows animation, to have it restored after reload.
|
|
516
|
-
|
|
526
|
+
this .browser .nextFrame () .then (() => this .nodeList .setNode (animation));
|
|
517
527
|
}
|
|
518
528
|
|
|
519
529
|
resizeAnimation (newDuration, newFrameRate, scaleKeyframes)
|
|
@@ -2013,80 +2023,83 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2013
2023
|
{
|
|
2014
2024
|
case " ":
|
|
2015
2025
|
{
|
|
2016
|
-
this .toggleAnimation ();
|
|
2017
|
-
|
|
2018
2026
|
event .preventDefault ();
|
|
2019
2027
|
event .stopPropagation ();
|
|
2028
|
+
|
|
2029
|
+
this .toggleAnimation ();
|
|
2020
2030
|
break;
|
|
2021
2031
|
}
|
|
2022
2032
|
case "ArrowLeft":
|
|
2023
2033
|
{
|
|
2024
|
-
this .previousFrame ();
|
|
2025
|
-
|
|
2026
2034
|
event .preventDefault ();
|
|
2027
2035
|
event .stopPropagation ();
|
|
2036
|
+
|
|
2037
|
+
this .previousFrame ();
|
|
2028
2038
|
break;
|
|
2029
2039
|
}
|
|
2030
2040
|
case "ArrowRight":
|
|
2031
2041
|
{
|
|
2032
|
-
this .nextFrame ();
|
|
2033
|
-
|
|
2034
2042
|
event .preventDefault ();
|
|
2035
2043
|
event .stopPropagation ();
|
|
2044
|
+
|
|
2045
|
+
this .nextFrame ();
|
|
2036
2046
|
break;
|
|
2037
2047
|
}
|
|
2038
2048
|
case "ArrowDown":
|
|
2039
2049
|
{
|
|
2040
|
-
this .firstFrame ();
|
|
2041
|
-
|
|
2042
2050
|
event .preventDefault ();
|
|
2043
2051
|
event .stopPropagation ();
|
|
2052
|
+
|
|
2053
|
+
this .firstFrame ();
|
|
2044
2054
|
break;
|
|
2045
2055
|
}
|
|
2046
2056
|
case "ArrowUp":
|
|
2047
2057
|
{
|
|
2048
|
-
this .lastFrame ();
|
|
2049
|
-
|
|
2050
2058
|
event .preventDefault ();
|
|
2051
2059
|
event .stopPropagation ();
|
|
2060
|
+
|
|
2061
|
+
this .lastFrame ();
|
|
2052
2062
|
break;
|
|
2053
2063
|
}
|
|
2054
2064
|
case "-":
|
|
2055
2065
|
{
|
|
2056
|
-
this .zoomOut ();
|
|
2057
|
-
|
|
2058
2066
|
event .preventDefault ();
|
|
2059
2067
|
event .stopPropagation ();
|
|
2068
|
+
|
|
2069
|
+
this .zoomOut ();
|
|
2060
2070
|
break;
|
|
2061
2071
|
}
|
|
2062
2072
|
case "+":
|
|
2063
2073
|
{
|
|
2064
|
-
this .zoomIn ();
|
|
2065
|
-
|
|
2066
2074
|
event .preventDefault ();
|
|
2067
2075
|
event .stopPropagation ();
|
|
2076
|
+
|
|
2077
|
+
this .zoomIn ();
|
|
2068
2078
|
break;
|
|
2069
2079
|
}
|
|
2070
2080
|
case "0":
|
|
2071
2081
|
{
|
|
2072
|
-
this .zoomFit ();
|
|
2073
|
-
|
|
2074
2082
|
event .preventDefault ();
|
|
2075
2083
|
event .stopPropagation ();
|
|
2084
|
+
|
|
2085
|
+
this .zoomFit ();
|
|
2076
2086
|
break;
|
|
2077
2087
|
}
|
|
2078
2088
|
case "1":
|
|
2079
2089
|
{
|
|
2080
|
-
this .zoom100 ();
|
|
2081
|
-
|
|
2082
2090
|
event .preventDefault ();
|
|
2083
2091
|
event .stopPropagation ();
|
|
2092
|
+
|
|
2093
|
+
this .zoom100 ();
|
|
2084
2094
|
break;
|
|
2085
2095
|
}
|
|
2086
2096
|
case "a":
|
|
2087
2097
|
{
|
|
2088
2098
|
if (event .metaKey || event .ctrlKey)
|
|
2089
2099
|
{
|
|
2100
|
+
event .preventDefault ();
|
|
2101
|
+
event .stopPropagation ();
|
|
2102
|
+
|
|
2090
2103
|
if (event .shiftKey)
|
|
2091
2104
|
{
|
|
2092
2105
|
this .setSelectedKeyframes ([ ]);
|
|
@@ -2096,9 +2109,6 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2096
2109
|
{
|
|
2097
2110
|
this .setSelectionRange (0, this .getDuration ());
|
|
2098
2111
|
}
|
|
2099
|
-
|
|
2100
|
-
event .preventDefault ();
|
|
2101
|
-
event .stopPropagation ();
|
|
2102
2112
|
}
|
|
2103
2113
|
|
|
2104
2114
|
break;
|
|
@@ -2107,10 +2117,10 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2107
2117
|
{
|
|
2108
2118
|
if (event .metaKey || event .ctrlKey)
|
|
2109
2119
|
{
|
|
2110
|
-
this .cutKeyframes ();
|
|
2111
|
-
|
|
2112
2120
|
event .preventDefault ();
|
|
2113
2121
|
event .stopPropagation ();
|
|
2122
|
+
|
|
2123
|
+
this .cutKeyframes ();
|
|
2114
2124
|
}
|
|
2115
2125
|
|
|
2116
2126
|
break;
|
|
@@ -2119,10 +2129,10 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2119
2129
|
{
|
|
2120
2130
|
if (event .metaKey || event .ctrlKey)
|
|
2121
2131
|
{
|
|
2122
|
-
this .copyKeyframes ();
|
|
2123
|
-
|
|
2124
2132
|
event .preventDefault ();
|
|
2125
2133
|
event .stopPropagation ();
|
|
2134
|
+
|
|
2135
|
+
this .copyKeyframes ();
|
|
2126
2136
|
}
|
|
2127
2137
|
|
|
2128
2138
|
break;
|
|
@@ -2131,20 +2141,20 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2131
2141
|
{
|
|
2132
2142
|
if (event .metaKey || event .ctrlKey)
|
|
2133
2143
|
{
|
|
2134
|
-
this .pasteKeyframes ();
|
|
2135
|
-
|
|
2136
2144
|
event .preventDefault ();
|
|
2137
2145
|
event .stopPropagation ();
|
|
2146
|
+
|
|
2147
|
+
this .pasteKeyframes ();
|
|
2138
2148
|
}
|
|
2139
2149
|
|
|
2140
2150
|
break;
|
|
2141
2151
|
}
|
|
2142
2152
|
case "Backspace":
|
|
2143
2153
|
{
|
|
2144
|
-
this .deleteKeyframes ();
|
|
2145
|
-
|
|
2146
2154
|
event .preventDefault ();
|
|
2147
2155
|
event .stopPropagation ();
|
|
2156
|
+
|
|
2157
|
+
this .deleteKeyframes ();
|
|
2148
2158
|
break;
|
|
2149
2159
|
}
|
|
2150
2160
|
}
|
|
@@ -2812,11 +2822,12 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2812
2822
|
{
|
|
2813
2823
|
const
|
|
2814
2824
|
tracksWidth = this .tracks .width (),
|
|
2815
|
-
tracksHeight = this .tracks .height ()
|
|
2825
|
+
tracksHeight = this .tracks .height (),
|
|
2826
|
+
contentScale = window .devicePixelRatio;
|
|
2816
2827
|
|
|
2817
2828
|
this .tracks
|
|
2818
|
-
.prop ("width", tracksWidth)
|
|
2819
|
-
.prop ("height", tracksHeight);
|
|
2829
|
+
.prop ("width", tracksWidth * contentScale)
|
|
2830
|
+
.prop ("height", tracksHeight * contentScale);
|
|
2820
2831
|
|
|
2821
2832
|
this .timelineClip = new Path2D ();
|
|
2822
2833
|
this .timelineClip .rect (this .getLeft () - this .FRAME_SIZE, 0, this .getWidth () + this .FRAME_SIZE * 2, tracksHeight);
|
|
@@ -2824,7 +2835,7 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2824
2835
|
this .drawTimeline ();
|
|
2825
2836
|
}
|
|
2826
2837
|
|
|
2827
|
-
#updateTracksId
|
|
2838
|
+
#updateTracksId;
|
|
2828
2839
|
|
|
2829
2840
|
requestDrawTimeline ()
|
|
2830
2841
|
{
|
|
@@ -2833,8 +2844,6 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2833
2844
|
this .#updateTracksId = setTimeout (() => this .drawTimeline ());
|
|
2834
2845
|
}
|
|
2835
2846
|
|
|
2836
|
-
#style = window .getComputedStyle ($("body") [0]);
|
|
2837
|
-
|
|
2838
2847
|
TRACK_PADDING = 8;
|
|
2839
2848
|
|
|
2840
2849
|
drawTimeline ()
|
|
@@ -2842,191 +2851,195 @@ module .exports = class AnimationEditor extends Interface
|
|
|
2842
2851
|
const
|
|
2843
2852
|
context = this .tracks [0] .getContext ("2d"),
|
|
2844
2853
|
tracksWidth = this .tracks .width (),
|
|
2845
|
-
tracksHeight = this .tracks .height ()
|
|
2854
|
+
tracksHeight = this .tracks .height (),
|
|
2855
|
+
contentScale = window .devicePixelRatio;
|
|
2846
2856
|
|
|
2857
|
+
context .save ();
|
|
2858
|
+
context .scale (contentScale, contentScale);
|
|
2847
2859
|
context .clearRect (0, 0, tracksWidth, tracksHeight);
|
|
2848
2860
|
|
|
2849
|
-
if (
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
lastFrame = Math .min (this .getDuration (), Math .ceil ((width - translation) / scale)) + 1;
|
|
2860
|
-
|
|
2861
|
-
const [frameStep, frameFactor] = this .getFrameParams ();
|
|
2862
|
-
|
|
2863
|
-
const
|
|
2864
|
-
blue = this .#style .getPropertyValue ("--system-blue"),
|
|
2865
|
-
indigo = this .#style .getPropertyValue ("--system-indigo"),
|
|
2866
|
-
orange = this .#style .getPropertyValue ("--system-orange"),
|
|
2867
|
-
brown = this .#style .getPropertyValue ("--system-brown"),
|
|
2868
|
-
red = this .#style .getPropertyValue ("--system-red"),
|
|
2869
|
-
range = this .#style .getPropertyValue ("--selection-range"),
|
|
2870
|
-
tint1 = this .#style .getPropertyValue ("--tint-color1"),
|
|
2871
|
-
tint2 = this .#style .getPropertyValue ("--tint-color2");
|
|
2861
|
+
if (this .animation)
|
|
2862
|
+
{
|
|
2863
|
+
const
|
|
2864
|
+
left = this .getLeft (),
|
|
2865
|
+
width = this .getWidth (),
|
|
2866
|
+
translation = this .getTranslation (),
|
|
2867
|
+
scale = this .getScale (),
|
|
2868
|
+
trackOffsets = this .memberList .getTrackOffsets (),
|
|
2869
|
+
firstFrame = Math .max (0, Math .floor (-translation / scale)),
|
|
2870
|
+
lastFrame = Math .min (this .getDuration (), Math .ceil ((width - translation) / scale)) + 1;
|
|
2872
2871
|
|
|
2873
|
-
|
|
2872
|
+
const [frameStep, frameFactor] = this .getFrameParams ();
|
|
2874
2873
|
|
|
2875
|
-
|
|
2876
|
-
|
|
2874
|
+
const
|
|
2875
|
+
blue = this .#style .getPropertyValue ("--system-blue"),
|
|
2876
|
+
indigo = this .#style .getPropertyValue ("--system-indigo"),
|
|
2877
|
+
orange = this .#style .getPropertyValue ("--system-orange"),
|
|
2878
|
+
brown = this .#style .getPropertyValue ("--system-brown"),
|
|
2879
|
+
red = this .#style .getPropertyValue ("--system-red"),
|
|
2880
|
+
range = this .#style .getPropertyValue ("--selection-range"),
|
|
2881
|
+
tint1 = this .#style .getPropertyValue ("--tint-color1"),
|
|
2882
|
+
tint2 = this .#style .getPropertyValue ("--tint-color2");
|
|
2877
2883
|
|
|
2878
|
-
|
|
2884
|
+
// Draw selection range.
|
|
2879
2885
|
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
const minFrame = X3D .Algorithm .clamp (selectionRange [0], firstFrame, lastFrame - 1);
|
|
2883
|
-
const maxFrame = X3D .Algorithm .clamp (selectionRange [1], firstFrame, lastFrame - 1);
|
|
2884
|
-
const x0 = left + minFrame * scale + translation;
|
|
2885
|
-
const x1 = left + maxFrame * scale + translation;
|
|
2886
|
+
context .save ();
|
|
2887
|
+
context .clip (this .timelineClip);
|
|
2886
2888
|
|
|
2887
|
-
|
|
2889
|
+
const selectionRange = this .getSelectionRange ();
|
|
2888
2890
|
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
+
if (selectionRange [0] !== selectionRange [1])
|
|
2892
|
+
{
|
|
2893
|
+
const minFrame = X3D .Algorithm .clamp (selectionRange [0], firstFrame, lastFrame - 1);
|
|
2894
|
+
const maxFrame = X3D .Algorithm .clamp (selectionRange [1], firstFrame, lastFrame - 1);
|
|
2895
|
+
const x0 = left + minFrame * scale + translation;
|
|
2896
|
+
const x1 = left + maxFrame * scale + translation;
|
|
2891
2897
|
|
|
2892
|
-
|
|
2898
|
+
context .fillStyle = range;
|
|
2893
2899
|
|
|
2894
|
-
|
|
2900
|
+
context .fillRect (Math .min (x0, x1) - 1, 0, Math .abs (x1 - x0) + 3, tracksHeight);
|
|
2901
|
+
}
|
|
2895
2902
|
|
|
2896
|
-
|
|
2897
|
-
{
|
|
2898
|
-
// Track
|
|
2903
|
+
context .restore ();
|
|
2899
2904
|
|
|
2900
|
-
|
|
2905
|
+
// Draw all tracks.
|
|
2901
2906
|
|
|
2902
|
-
|
|
2907
|
+
for (const [i, { item, top, bottom, height }] of trackOffsets .entries ())
|
|
2903
2908
|
{
|
|
2904
|
-
//
|
|
2909
|
+
// Track
|
|
2905
2910
|
|
|
2906
|
-
|
|
2911
|
+
const odd = item .data ("i") % 2;
|
|
2912
|
+
|
|
2913
|
+
if (odd || i === 0)
|
|
2907
2914
|
{
|
|
2908
|
-
|
|
2915
|
+
// Draw a line below last field.
|
|
2909
2916
|
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
else if (item .hasClass ("field"))
|
|
2914
|
-
{
|
|
2915
|
-
// Draw a bar.
|
|
2917
|
+
if (trackOffsets [i + 1] ?.item .hasClass ("node") ?? true)
|
|
2918
|
+
{
|
|
2919
|
+
context .fillStyle = tint2;
|
|
2916
2920
|
|
|
2917
|
-
|
|
2921
|
+
context .fillRect (0, bottom - 1, tracksWidth, 1);
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
else if (item .hasClass ("field"))
|
|
2925
|
+
{
|
|
2926
|
+
// Draw a bar.
|
|
2918
2927
|
|
|
2919
|
-
|
|
2920
|
-
}
|
|
2928
|
+
context .fillStyle = tint1;
|
|
2921
2929
|
|
|
2922
|
-
|
|
2930
|
+
context .fillRect (0, top, tracksWidth, height);
|
|
2931
|
+
}
|
|
2923
2932
|
|
|
2924
|
-
|
|
2933
|
+
// Highlight track on hover.
|
|
2925
2934
|
|
|
2926
|
-
|
|
2927
|
-
item .addClass ("hover-track");
|
|
2928
|
-
else
|
|
2929
|
-
item .removeClass ("hover-track");
|
|
2935
|
+
const hover = this .pointer .y > top && this .pointer .y < bottom;
|
|
2930
2936
|
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2937
|
+
if (hover)
|
|
2938
|
+
item .addClass ("hover-track");
|
|
2939
|
+
else
|
|
2940
|
+
item .removeClass ("hover-track");
|
|
2934
2941
|
|
|
2935
|
-
|
|
2936
|
-
|
|
2942
|
+
if (item .is (".hover, .hover-tracks") || hover)
|
|
2943
|
+
{
|
|
2944
|
+
context .fillStyle = tint2;
|
|
2937
2945
|
|
|
2938
|
-
|
|
2946
|
+
context .fillRect (0, top, tracksWidth, height);
|
|
2947
|
+
}
|
|
2939
2948
|
|
|
2940
|
-
|
|
2941
|
-
context .clip (this .timelineClip);
|
|
2949
|
+
// Frames
|
|
2942
2950
|
|
|
2943
|
-
|
|
2951
|
+
context .save ();
|
|
2952
|
+
context .clip (this .timelineClip);
|
|
2944
2953
|
|
|
2945
|
-
|
|
2946
|
-
context .lineWidth = item .is (".main, .node") ? 3 : 1;
|
|
2954
|
+
// Draw vertical lines.
|
|
2947
2955
|
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
const s = frame % frameFactor; // size (large or small)
|
|
2951
|
-
const y = Math .floor (top + height * (s ? 0.75 : 0.5));
|
|
2952
|
-
const x = Math .floor (left + this .getPointerFromFrame (frame));
|
|
2956
|
+
context .strokeStyle = item .hasClass ("main") ? indigo : blue;
|
|
2957
|
+
context .lineWidth = item .is (".main, .node") ? 3 : 1;
|
|
2953
2958
|
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
+
for (let frame = firstFrame - (firstFrame % frameStep); frame < lastFrame; frame += frameStep)
|
|
2960
|
+
{
|
|
2961
|
+
const s = frame % frameFactor; // size (large or small)
|
|
2962
|
+
const y = Math .floor (top + height * (s ? 0.75 : 0.5));
|
|
2963
|
+
const x = Math .floor (left + this .getPointerFromFrame (frame));
|
|
2964
|
+
|
|
2965
|
+
context .beginPath ();
|
|
2966
|
+
context .moveTo (x + 0.5, y - this .TRACK_PADDING);
|
|
2967
|
+
context .lineTo (x + 0.5, bottom - this .TRACK_PADDING);
|
|
2968
|
+
context .stroke ();
|
|
2969
|
+
}
|
|
2959
2970
|
|
|
2960
|
-
|
|
2971
|
+
// Draw keyframes.
|
|
2961
2972
|
|
|
2962
|
-
|
|
2963
|
-
{
|
|
2964
|
-
case "main":
|
|
2973
|
+
switch (item .attr ("type"))
|
|
2965
2974
|
{
|
|
2966
|
-
|
|
2967
|
-
|
|
2975
|
+
case "main":
|
|
2976
|
+
{
|
|
2977
|
+
for (const field of this .fields .keys ())
|
|
2978
|
+
this .drawKeyframes (context, field, firstFrame, lastFrame, bottom - this .TRACK_PADDING, brown);
|
|
2968
2979
|
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2980
|
+
break;
|
|
2981
|
+
}
|
|
2982
|
+
case "node":
|
|
2983
|
+
{
|
|
2984
|
+
const node = item .data ("node");
|
|
2974
2985
|
|
|
2975
|
-
|
|
2976
|
-
|
|
2986
|
+
for (const field of node .getFields ())
|
|
2987
|
+
this .drawKeyframes (context, field, firstFrame, lastFrame, bottom - this .TRACK_PADDING, brown);
|
|
2977
2988
|
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2989
|
+
break;
|
|
2990
|
+
}
|
|
2991
|
+
case "field":
|
|
2992
|
+
{
|
|
2993
|
+
this .drawKeyframes (context, item .data ("field"), firstFrame, lastFrame, bottom - this .TRACK_PADDING, orange);
|
|
2994
|
+
break;
|
|
2995
|
+
}
|
|
2984
2996
|
}
|
|
2985
|
-
}
|
|
2986
2997
|
|
|
2987
|
-
|
|
2998
|
+
// Draw selected keyframes.
|
|
2988
2999
|
|
|
2989
|
-
|
|
2990
|
-
{
|
|
2991
|
-
case "main":
|
|
3000
|
+
switch (item .attr ("type"))
|
|
2992
3001
|
{
|
|
2993
|
-
|
|
3002
|
+
case "main":
|
|
3003
|
+
{
|
|
3004
|
+
const fields = new Set (this .fields .keys ());
|
|
2994
3005
|
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3006
|
+
this .drawSelectedKeyframes (context, fields, bottom - this .TRACK_PADDING, red);
|
|
3007
|
+
break;
|
|
3008
|
+
}
|
|
3009
|
+
case "node":
|
|
3010
|
+
{
|
|
3011
|
+
const
|
|
3012
|
+
node = item .data ("node"),
|
|
3013
|
+
fields = new Set (node .getFields ());
|
|
3003
3014
|
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3015
|
+
this .drawSelectedKeyframes (context, fields, bottom - this .TRACK_PADDING, red);
|
|
3016
|
+
break;
|
|
3017
|
+
}
|
|
3018
|
+
case "field":
|
|
3019
|
+
{
|
|
3020
|
+
const fields = new Set ([item .data ("field")]);
|
|
3010
3021
|
|
|
3011
|
-
|
|
3012
|
-
|
|
3022
|
+
this .drawSelectedKeyframes (context, fields, bottom - this .TRACK_PADDING, red);
|
|
3023
|
+
break;
|
|
3024
|
+
}
|
|
3013
3025
|
}
|
|
3014
|
-
}
|
|
3015
3026
|
|
|
3016
|
-
|
|
3017
|
-
|
|
3027
|
+
context .restore ();
|
|
3028
|
+
}
|
|
3018
3029
|
|
|
3019
|
-
|
|
3030
|
+
// Draw current frame cursor.
|
|
3020
3031
|
|
|
3021
|
-
|
|
3022
|
-
|
|
3032
|
+
context .save ();
|
|
3033
|
+
context .clip (this .timelineClip);
|
|
3023
3034
|
|
|
3024
|
-
|
|
3025
|
-
|
|
3035
|
+
const frame = this .getCurrentFrame ();
|
|
3036
|
+
const x = Math .floor (left + this .getPointerFromFrame (frame));
|
|
3026
3037
|
|
|
3027
|
-
|
|
3038
|
+
context .fillStyle = blue;
|
|
3028
3039
|
|
|
3029
|
-
|
|
3040
|
+
context .fillRect (x - 1, 0, 3, tracksHeight);
|
|
3041
|
+
context .restore ();
|
|
3042
|
+
}
|
|
3030
3043
|
|
|
3031
3044
|
context .restore ();
|
|
3032
3045
|
}
|