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.
- package/package.json +7 -7
- package/src/Application/Application.js +22 -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 +83 -59
- package/src/Editors/AnimationMemberList.js +37 -6
- package/src/Editors/BrowserFrame.js +17 -10
- package/src/Editors/Console.js +12 -14
- package/src/Editors/NodeList.js +35 -0
- package/src/Editors/OutlineEditor.js +24 -22
- package/src/Editors/OutlineView.js +85 -61
- package/src/Editors/Panel.js +6 -3
- package/src/Editors/RouteGraph.js +22 -65
- package/src/Editors/SceneProperties.js +9 -5
- package/src/Editors/ScriptEditor.js +37 -23
- package/src/Editors/VideoRecorder.js +145 -0
- package/src/Tools/Core/X3DBaseTool.js +12 -11
- package/src/Tools/Core/X3DImportedNodeInstanceTool.js +52 -0
- package/src/Tools/Core/X3DPrototypeInstanceTool.js +6 -6
- 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 +38 -13
- package/src/assets/html/window.html +6 -7
- package/src/assets/themes/default.css +186 -176
- package/src/assets/themes/{system-colors.css → definitions.css} +155 -173
- package/src/assets/themes/fonts.css +45 -0
- package/src/assets/themes/media-template.css +3 -2
- package/src/assets/themes/media.css +3 -2
- package/src/assets/themes/prompt-template.css +5 -1
- package/src/assets/themes/prompt.css +5 -1
- package/src/assets/html/application-template.html +0 -164
- package/src/assets/html/window-template.html +0 -39
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const
|
|
4
|
-
Tabs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
$ = require ("jquery"),
|
|
8
|
-
_ = require ("./GetText");
|
|
4
|
+
Tabs = require ("../Controls/Tabs"),
|
|
5
|
+
$ = require ("jquery"),
|
|
6
|
+
_ = require ("./GetText");
|
|
9
7
|
|
|
10
8
|
module .exports = class Footer extends Tabs
|
|
11
9
|
{
|
|
@@ -13,40 +11,68 @@ module .exports = class Footer extends Tabs
|
|
|
13
11
|
{
|
|
14
12
|
super (element, "bottom");
|
|
15
13
|
|
|
14
|
+
this .footer = element;
|
|
15
|
+
this .editors = new Map ();
|
|
16
|
+
|
|
17
|
+
// Buttons
|
|
18
|
+
|
|
19
|
+
this .buttons = $("<div></div>")
|
|
20
|
+
.addClass ("buttons");
|
|
21
|
+
|
|
22
|
+
this .maximizeButton = $("<span></span>")
|
|
23
|
+
.addClass (["material-symbols-outlined", "button"])
|
|
24
|
+
.attr ("title", _("Maximize Panel."))
|
|
25
|
+
.css ("scale", "0.8")
|
|
26
|
+
.text ("expand")
|
|
27
|
+
.appendTo (this .buttons);
|
|
28
|
+
|
|
16
29
|
this .setup ();
|
|
17
30
|
}
|
|
18
31
|
|
|
19
32
|
addTabs ()
|
|
20
33
|
{
|
|
21
|
-
this .addIconTextTab ("console", "menu", _("Console"))
|
|
22
|
-
|
|
34
|
+
this .addIconTextTab ("console", "menu", _("Console"));
|
|
35
|
+
this .addIconTextTab ("script-editor", "data_array", _("Script Editor"));
|
|
36
|
+
this .addIconTextTab ("animation-editor", "animation", _("Keyframe Animation"));
|
|
37
|
+
this .addIconTextTab ("route-graph", "route", _("Route Graph"));
|
|
23
38
|
|
|
24
|
-
|
|
25
|
-
.
|
|
39
|
+
if (process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT")
|
|
40
|
+
this .addIconTextTab ("video-recorder", "videocam", _("Video Recorder"));
|
|
26
41
|
|
|
27
|
-
this .
|
|
28
|
-
|
|
42
|
+
this .activateTab (3);
|
|
43
|
+
this .activateTab (0);
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
.find (".material-icons") .css ("color", "hsl(281, 40%, 48%)");
|
|
45
|
+
// Add toolbar stub after all tabs are created.
|
|
32
46
|
|
|
33
47
|
$("<div></div>")
|
|
34
48
|
.addClass (["toolbar", "vertical-toolbar"])
|
|
35
|
-
.appendTo (this .
|
|
49
|
+
.appendTo (this .footer);
|
|
50
|
+
|
|
51
|
+
// Add buttons after all tabs are created.
|
|
36
52
|
|
|
37
|
-
this .
|
|
38
|
-
this .routeGraph = new RouteGraph (this .getPanel ("route-graph"));
|
|
53
|
+
this .buttons .appendTo (this .footer);
|
|
39
54
|
}
|
|
40
55
|
|
|
41
56
|
initTab (panel)
|
|
42
57
|
{
|
|
43
58
|
switch (panel .attr ("id"))
|
|
44
59
|
{
|
|
60
|
+
case "console":
|
|
61
|
+
{
|
|
62
|
+
const Console = require ("../Editors/Console");
|
|
63
|
+
|
|
64
|
+
this .console = new Console (panel);
|
|
65
|
+
|
|
66
|
+
this .editors .set (panel .attr ("id"), this .console);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
45
69
|
case "script-editor":
|
|
46
70
|
{
|
|
47
71
|
const ScriptEditor = require ("../Editors/ScriptEditor");
|
|
48
72
|
|
|
49
73
|
this .scriptEditor = new ScriptEditor (panel);
|
|
74
|
+
|
|
75
|
+
this .editors .set (panel .attr ("id"), this .scriptEditor);
|
|
50
76
|
break;
|
|
51
77
|
}
|
|
52
78
|
case "animation-editor":
|
|
@@ -54,6 +80,26 @@ module .exports = class Footer extends Tabs
|
|
|
54
80
|
const AnimationEditor = require ("../Editors/AnimationEditor");
|
|
55
81
|
|
|
56
82
|
this .animationEditor = new AnimationEditor (panel);
|
|
83
|
+
|
|
84
|
+
this .editors .set (panel .attr ("id"), this .animationEditor);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
case "route-graph":
|
|
88
|
+
{
|
|
89
|
+
const RouteGraph = require ("../Editors/RouteGraph");
|
|
90
|
+
|
|
91
|
+
this .routeGraph = new RouteGraph (panel);
|
|
92
|
+
|
|
93
|
+
this .editors .set (panel .attr ("id"), this .routeGraph);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case "video-recorder":
|
|
97
|
+
{
|
|
98
|
+
const VideoRecorder = require ("../Editors/VideoRecorder");
|
|
99
|
+
|
|
100
|
+
this .videoRecorder = new VideoRecorder (panel);
|
|
101
|
+
|
|
102
|
+
this .editors .set (panel .attr ("id"), this .videoRecorder);
|
|
57
103
|
break;
|
|
58
104
|
}
|
|
59
105
|
}
|
|
@@ -71,7 +71,7 @@ module .exports = new class Hierarchy extends Interface
|
|
|
71
71
|
const node = object .getValue () .valueOf ();
|
|
72
72
|
|
|
73
73
|
if (!node .getType () .some (type => this .#targetTypes .has (type)) &&
|
|
74
|
-
!(node instanceof X3D .
|
|
74
|
+
!(node instanceof X3D .X3DImportedNodeInstance))
|
|
75
75
|
{
|
|
76
76
|
continue;
|
|
77
77
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
_ = require ("./GetText");
|
|
4
|
+
Tabs = require ("../Controls/Tabs"),
|
|
5
|
+
_ = require ("./GetText");
|
|
7
6
|
|
|
8
7
|
module .exports = class Sidebar extends Tabs
|
|
9
8
|
{
|
|
@@ -16,15 +15,12 @@ module .exports = class Sidebar extends Tabs
|
|
|
16
15
|
|
|
17
16
|
addTabs ()
|
|
18
17
|
{
|
|
19
|
-
if (process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT")
|
|
20
|
-
|
|
18
|
+
// if (process .env .SUNRISE_ENVIRONMENT === "DEVELOPMENT")
|
|
19
|
+
// this .addIconTab ("file-manager", "description", _("File Manager"));
|
|
21
20
|
|
|
22
21
|
this .addIconTab ("outline-editor", "list", _("Outline Editor"));
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
this .addIconTab ("node-inspector", "visibility", _("Node Inspector"));
|
|
26
|
-
|
|
27
|
-
this .outlineEditor = new OutlineEditor (this .getPanel ("outline-editor"));
|
|
23
|
+
this .activateTab (0);
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
configure ()
|
|
@@ -43,6 +39,13 @@ module .exports = class Sidebar extends Tabs
|
|
|
43
39
|
this .fileManger = new FileManager (panel);
|
|
44
40
|
break;
|
|
45
41
|
}
|
|
42
|
+
case "outline-editor":
|
|
43
|
+
{
|
|
44
|
+
const OutlineEditor = require ("../Editors/OutlineEditor");
|
|
45
|
+
|
|
46
|
+
this .outlineEditor = new OutlineEditor (panel);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
46
49
|
case "node-inspector":
|
|
47
50
|
{
|
|
48
51
|
const NodeInspector = require ("../Editors/NodeInspector");
|
package/src/Application/Tabs.js
CHANGED
|
@@ -13,7 +13,7 @@ const
|
|
|
13
13
|
require ("electron-tabs");
|
|
14
14
|
require ("./CSS");
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
class Tabs
|
|
17
17
|
{
|
|
18
18
|
// Construction
|
|
19
19
|
|
|
@@ -49,10 +49,16 @@ module .exports = new class Tabs
|
|
|
49
49
|
|
|
50
50
|
electron .ipcRenderer .send ("locale", _.locale);
|
|
51
51
|
|
|
52
|
-
//
|
|
52
|
+
// Get TabGroup
|
|
53
53
|
|
|
54
54
|
this .tabs = $("tab-group") .get (0);
|
|
55
55
|
|
|
56
|
+
// Create Buttons
|
|
57
|
+
|
|
58
|
+
this .buttons = new Buttons (this .tabs, $(this .tabs .shadowRoot) .find (".etabs .buttons"));
|
|
59
|
+
|
|
60
|
+
// Connect to TabGroup Events
|
|
61
|
+
|
|
56
62
|
this .tabs .on ("tab-active", tab =>
|
|
57
63
|
{
|
|
58
64
|
electron .ipcRenderer .send ("title", tab .getTitle ());
|
|
@@ -104,6 +110,8 @@ module .exports = new class Tabs
|
|
|
104
110
|
this .forwardToActiveTab ("transform-to-zero");
|
|
105
111
|
this .forwardToActiveTab ("remove-empty-groups");
|
|
106
112
|
|
|
113
|
+
this .forwardToActiveTab ("toggle-sidebar");
|
|
114
|
+
this .forwardToActiveTab ("toggle-footer");
|
|
107
115
|
this .forwardToAllTabs ("expand-extern-proto-declarations");
|
|
108
116
|
this .forwardToAllTabs ("expand-prototype-instances");
|
|
109
117
|
this .forwardToAllTabs ("expand-inline-nodes");
|
|
@@ -129,6 +137,7 @@ module .exports = new class Tabs
|
|
|
129
137
|
this .forwardToActiveTab ("move-selection-center-to-snap-target");
|
|
130
138
|
|
|
131
139
|
this .forwardToActiveTab ("document");
|
|
140
|
+
this .forwardToActiveTab ("node-list");
|
|
132
141
|
this .forwardToActiveTab ("script-editor");
|
|
133
142
|
this .forwardToActiveTab ("animation-members-list");
|
|
134
143
|
this .forwardToActiveTab ("route-graph");
|
|
@@ -294,6 +303,16 @@ module .exports = new class Tabs
|
|
|
294
303
|
this .setMute (tab, ... event .args);
|
|
295
304
|
break;
|
|
296
305
|
}
|
|
306
|
+
case "footer":
|
|
307
|
+
{
|
|
308
|
+
this .buttons .setFooter (... event .args);
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
case "sidebar":
|
|
312
|
+
{
|
|
313
|
+
this .buttons .setSidebar (... event .args);
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
297
316
|
}
|
|
298
317
|
});
|
|
299
318
|
|
|
@@ -714,14 +733,6 @@ module .exports = new class Tabs
|
|
|
714
733
|
|
|
715
734
|
for (const tab of tabs)
|
|
716
735
|
tab .webview .send ("close");
|
|
717
|
-
|
|
718
|
-
this .maintenance ();
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
maintenance ()
|
|
722
|
-
{
|
|
723
|
-
// Remove items older than one year, time in milliseconds.
|
|
724
|
-
// new DataStorage (localStorage, "Sunrize.") .removeItems (Date .now () - (1000 * 60 * 60 * 24 * 365));
|
|
725
736
|
}
|
|
726
737
|
|
|
727
738
|
// Send messages to tabs
|
|
@@ -735,4 +746,61 @@ module .exports = new class Tabs
|
|
|
735
746
|
{
|
|
736
747
|
electron .ipcRenderer .on (channel, (event, ... args) => this .tabs .getTabs () .forEach (tab => tab .webview .send (channel, ... args)));
|
|
737
748
|
}
|
|
738
|
-
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
class Buttons
|
|
752
|
+
{
|
|
753
|
+
constructor (tabs, element)
|
|
754
|
+
{
|
|
755
|
+
this .tabs = tabs;
|
|
756
|
+
this .buttons = element;
|
|
757
|
+
|
|
758
|
+
const darwin = process .platform === "darwin";
|
|
759
|
+
|
|
760
|
+
this .toggleFooterButton = $("<span></span>")
|
|
761
|
+
.addClass ("material-symbols-outlined")
|
|
762
|
+
.attr ("title", darwin
|
|
763
|
+
? _("Toggle Panel. (⌘J)")
|
|
764
|
+
: _("Toggle Panel. (Ctrl+J)"))
|
|
765
|
+
.text ("dock_to_bottom")
|
|
766
|
+
.appendTo (this .buttons)
|
|
767
|
+
.on ("click", () => this .toggleFooter ());
|
|
768
|
+
|
|
769
|
+
this .toggleSidebarButton = $("<span></span>")
|
|
770
|
+
.addClass ("material-symbols-outlined")
|
|
771
|
+
.attr ("title", darwin
|
|
772
|
+
? _("Toggle Sidebar. (⌘B)")
|
|
773
|
+
: _("Toggle Sidebar. (Ctrl+B)"))
|
|
774
|
+
.text ("dock_to_left")
|
|
775
|
+
.appendTo (this .buttons)
|
|
776
|
+
.on ("click", () => this .toggleSidebar ());
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
setFooter (state)
|
|
780
|
+
{
|
|
781
|
+
if (state)
|
|
782
|
+
this .toggleFooterButton .addClass ("fill");
|
|
783
|
+
else
|
|
784
|
+
this .toggleFooterButton .removeClass ("fill");
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
toggleFooter ()
|
|
788
|
+
{
|
|
789
|
+
this .tabs .getActiveTab () ?.webview .send ("toggle-footer");
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
setSidebar (state)
|
|
793
|
+
{
|
|
794
|
+
if (state)
|
|
795
|
+
this .toggleSidebarButton .addClass ("fill");
|
|
796
|
+
else
|
|
797
|
+
this .toggleSidebarButton .removeClass ("fill");
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
toggleSidebar ()
|
|
801
|
+
{
|
|
802
|
+
this .tabs .getActiveTab () ?.webview .send ("toggle-sidebar");
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
module .exports = new Tabs ();
|
package/src/Controls/Splitter.js
CHANGED
|
@@ -5,6 +5,11 @@ const
|
|
|
5
5
|
Interface = require ("../Application/Interface"),
|
|
6
6
|
Algorithm = require ("../Bits/Algorithm");
|
|
7
7
|
|
|
8
|
+
/* eslint no-self-assign: "off"
|
|
9
|
+
--------
|
|
10
|
+
no-self-assign: `this.position` is updated from getter.
|
|
11
|
+
*/
|
|
12
|
+
|
|
8
13
|
module .exports = class Splitter extends Interface
|
|
9
14
|
{
|
|
10
15
|
constructor (element, orientation)
|
|
@@ -18,28 +23,32 @@ module .exports = class Splitter extends Interface
|
|
|
18
23
|
{
|
|
19
24
|
case "horizontal":
|
|
20
25
|
{
|
|
21
|
-
|
|
26
|
+
this .handle = this .splitter .find ("> .horizontal-splitter-top");
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
this .handle .resizable ({
|
|
24
29
|
minHeight: 0,
|
|
25
30
|
handles: "s",
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
})
|
|
32
|
+
.on ("resizestart", event => this .start (event))
|
|
33
|
+
.on ("resizestop", event=> this .stop (event))
|
|
34
|
+
.on ("resize", event => this .resize (event));
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
this .handle .find ("> .ui-resizable-s") .append ($("<div></div>"));
|
|
30
37
|
break;
|
|
31
38
|
}
|
|
32
39
|
case "vertical":
|
|
33
40
|
{
|
|
34
|
-
|
|
41
|
+
this .handle = this .splitter .find ("> .vertical-splitter-left");
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
this .handle .resizable ({
|
|
37
44
|
minWidth: 0,
|
|
38
45
|
handles: "e",
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
})
|
|
47
|
+
.on ("resizestart", event=> this .start (event))
|
|
48
|
+
.on ("resizestop", event=> this .stop (event))
|
|
49
|
+
.on ("resize", event => this .resize (event));
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
this .handle .find ("> .ui-resizable-e") .append ($("<div></div>"));
|
|
43
52
|
break;
|
|
44
53
|
}
|
|
45
54
|
}
|
|
@@ -49,10 +58,14 @@ module .exports = class Splitter extends Interface
|
|
|
49
58
|
|
|
50
59
|
configure ()
|
|
51
60
|
{
|
|
52
|
-
|
|
61
|
+
this .config .file .setDefaultValues ({
|
|
62
|
+
startPosition: 0,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (!this .isInitialScene && this .config .file .position !== undefined)
|
|
53
66
|
this .position = this .config .file .position;
|
|
54
67
|
else
|
|
55
|
-
this .
|
|
68
|
+
this .handle .trigger ("position");
|
|
56
69
|
}
|
|
57
70
|
|
|
58
71
|
get position ()
|
|
@@ -63,17 +76,22 @@ module .exports = class Splitter extends Interface
|
|
|
63
76
|
{
|
|
64
77
|
const top = this .splitter .find ("> .horizontal-splitter-top");
|
|
65
78
|
|
|
66
|
-
return top .outerHeight () / this .splitter .innerHeight ();
|
|
79
|
+
return Algorithm .clamp ((top .outerHeight () / this .splitter .innerHeight ()) || 0, 0, 1);
|
|
67
80
|
}
|
|
68
81
|
case "vertical":
|
|
69
82
|
{
|
|
70
83
|
const left = this .splitter .find ("> .vertical-splitter-left");
|
|
71
84
|
|
|
72
|
-
return left .outerWidth () / this .splitter .innerWidth ();
|
|
85
|
+
return Algorithm .clamp ((left .outerWidth () / this .splitter .innerWidth ()) || 0, 0, 1);
|
|
73
86
|
}
|
|
74
87
|
}
|
|
88
|
+
|
|
89
|
+
return 0.5;
|
|
75
90
|
}
|
|
76
91
|
|
|
92
|
+
snapToBorder = false;
|
|
93
|
+
snapDistance = 30;
|
|
94
|
+
|
|
77
95
|
/**
|
|
78
96
|
* @param {number} position
|
|
79
97
|
*/
|
|
@@ -81,6 +99,9 @@ module .exports = class Splitter extends Interface
|
|
|
81
99
|
{
|
|
82
100
|
position = Algorithm .clamp (position, 0, 1);
|
|
83
101
|
|
|
102
|
+
if (this .snapToBorder)
|
|
103
|
+
position = this .snap (position);
|
|
104
|
+
|
|
84
105
|
this .config .file .position = position;
|
|
85
106
|
|
|
86
107
|
switch (this .orientation)
|
|
@@ -91,8 +112,8 @@ module .exports = class Splitter extends Interface
|
|
|
91
112
|
top = this .splitter .find ("> .horizontal-splitter-top"),
|
|
92
113
|
bottom = this .splitter .find ("> .horizontal-splitter-bottom");
|
|
93
114
|
|
|
94
|
-
top .css ("height",
|
|
95
|
-
bottom .css ("height",
|
|
115
|
+
top .css ("height", `${100 * position}%`);
|
|
116
|
+
bottom .css ("height", `${100 * (1 - position)}%`);
|
|
96
117
|
break;
|
|
97
118
|
}
|
|
98
119
|
case "vertical":
|
|
@@ -101,12 +122,118 @@ module .exports = class Splitter extends Interface
|
|
|
101
122
|
left = this .splitter .find ("> .vertical-splitter-left"),
|
|
102
123
|
right = this .splitter .find ("> .vertical-splitter-right");
|
|
103
124
|
|
|
104
|
-
left .css ("width",
|
|
105
|
-
right .css ("width",
|
|
125
|
+
left .css ("width", `${100 * position}%`);
|
|
126
|
+
right .css ("width", `${100 * (1 - position)}%`);
|
|
106
127
|
break;
|
|
107
128
|
}
|
|
108
129
|
}
|
|
109
130
|
|
|
110
|
-
this .
|
|
131
|
+
this .handle .trigger ("position");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
start (event)
|
|
135
|
+
{
|
|
136
|
+
event .stopPropagation ();
|
|
137
|
+
|
|
138
|
+
const position = this .position;
|
|
139
|
+
|
|
140
|
+
if (position > 0 && position < 1)
|
|
141
|
+
this .config .file .startPosition = this .position;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
stop (event)
|
|
145
|
+
{
|
|
146
|
+
event .stopPropagation ();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
resize (event)
|
|
150
|
+
{
|
|
151
|
+
event .stopPropagation ();
|
|
152
|
+
|
|
153
|
+
this .position = this .position;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
toggle (action)
|
|
157
|
+
{
|
|
158
|
+
switch (action)
|
|
159
|
+
{
|
|
160
|
+
case "minimize":
|
|
161
|
+
{
|
|
162
|
+
const position = this .position;
|
|
163
|
+
|
|
164
|
+
if (position > 0 && position < 1)
|
|
165
|
+
this .config .file .startPosition = position;
|
|
166
|
+
|
|
167
|
+
this .position = 0;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
case "maximize":
|
|
171
|
+
{
|
|
172
|
+
const position = this .position;
|
|
173
|
+
|
|
174
|
+
if (position > 0 && position < 1)
|
|
175
|
+
this .config .file .startPosition = position;
|
|
176
|
+
|
|
177
|
+
this .position = 1;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
case "restore":
|
|
181
|
+
{
|
|
182
|
+
const snapStartPosition = this .snap (this .config .file .startPosition);
|
|
183
|
+
|
|
184
|
+
if (snapStartPosition === 0 || snapStartPosition === 1)
|
|
185
|
+
{
|
|
186
|
+
this .config .file .position = undefined;
|
|
187
|
+
|
|
188
|
+
switch (this .orientation)
|
|
189
|
+
{
|
|
190
|
+
case "horizontal":
|
|
191
|
+
this .splitter .find ("> *") .css ("height", "");
|
|
192
|
+
break;
|
|
193
|
+
case "vertical":
|
|
194
|
+
this .splitter .find ("> *") .css ("width", "");
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
this .handle .trigger ("position");
|
|
199
|
+
}
|
|
200
|
+
else
|
|
201
|
+
{
|
|
202
|
+
this .position = this .config .file .startPosition;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
snap (position)
|
|
211
|
+
{
|
|
212
|
+
let size = 0;
|
|
213
|
+
|
|
214
|
+
switch (this .orientation)
|
|
215
|
+
{
|
|
216
|
+
case "horizontal":
|
|
217
|
+
{
|
|
218
|
+
size = this .splitter .innerHeight ();
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
case "vertical":
|
|
222
|
+
{
|
|
223
|
+
size = this .splitter .innerWidth ();
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (!size)
|
|
229
|
+
return position;
|
|
230
|
+
|
|
231
|
+
if (position < this .snapDistance / size)
|
|
232
|
+
return 0;
|
|
233
|
+
|
|
234
|
+
if (position > 1 - this .snapDistance / size)
|
|
235
|
+
return 1;
|
|
236
|
+
|
|
237
|
+
return position;
|
|
111
238
|
}
|
|
112
239
|
};
|
package/src/Controls/Tabs.js
CHANGED
|
@@ -36,20 +36,20 @@ module .exports = class Tabs extends Interface
|
|
|
36
36
|
this .element .tabs ("option", "active", this .config .file .active);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
activateTab ()
|
|
39
|
+
activateTab (active = this .element .tabs ("option", "active"))
|
|
40
40
|
{
|
|
41
|
-
const
|
|
42
|
-
active = this .element .tabs ("option", "active"),
|
|
43
|
-
panel = $(this .element .find (`.tabs-panel`) .get (active));
|
|
41
|
+
const panel = $(this .element .find (`.tabs-panel`) .get (active));
|
|
44
42
|
|
|
45
43
|
this .config .file .active = active;
|
|
46
44
|
|
|
47
|
-
if (panel .data ("Tabs.initialized"))
|
|
48
|
-
|
|
45
|
+
if (!panel .data ("Tabs.initialized"))
|
|
46
|
+
{
|
|
47
|
+
panel .data ("Tabs.initialized", true);
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
this .initTab (panel);
|
|
50
|
+
}
|
|
51
51
|
|
|
52
|
-
this .
|
|
52
|
+
this .tabActivated (panel);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
addTextTab (id, title)
|
|
@@ -60,6 +60,7 @@ module .exports = class Tabs extends Interface
|
|
|
60
60
|
.attr ("href", `#${id}-tab`)
|
|
61
61
|
.attr ("title", title)
|
|
62
62
|
.text (title))
|
|
63
|
+
.attr ("ondragstart", "return false;")
|
|
63
64
|
.appendTo (this .tabs);
|
|
64
65
|
|
|
65
66
|
this .addPanel (id);
|
|
@@ -74,8 +75,9 @@ module .exports = class Tabs extends Interface
|
|
|
74
75
|
.addClass ("icon")
|
|
75
76
|
.attr ("href", `#${id}-tab`)
|
|
76
77
|
.attr ("title", title)
|
|
78
|
+
.attr ("ondragstart", "return false;")
|
|
77
79
|
.append ($("<span></span>")
|
|
78
|
-
.addClass ("material-
|
|
80
|
+
.addClass ("material-symbols-outlined")
|
|
79
81
|
.text (icon)))
|
|
80
82
|
.appendTo (this .tabs);
|
|
81
83
|
|
|
@@ -91,10 +93,10 @@ module .exports = class Tabs extends Interface
|
|
|
91
93
|
.addClass ("icon-text")
|
|
92
94
|
.attr ("href", `#${id}-tab`)
|
|
93
95
|
.attr ("title", title)
|
|
94
|
-
.attr ("ondragstart", "return false;")
|
|
95
96
|
.text (title)
|
|
97
|
+
.attr ("ondragstart", "return false;")
|
|
96
98
|
.prepend ($("<span></span>")
|
|
97
|
-
.addClass ("material-
|
|
99
|
+
.addClass ("material-symbols-outlined")
|
|
98
100
|
.text (icon)))
|
|
99
101
|
.appendTo (this .tabs);
|
|
100
102
|
|
|
@@ -105,7 +107,7 @@ module .exports = class Tabs extends Interface
|
|
|
105
107
|
|
|
106
108
|
addPanel (id)
|
|
107
109
|
{
|
|
108
|
-
$("<div></div>")
|
|
110
|
+
return $("<div></div>")
|
|
109
111
|
.attr ("id", `${id}-tab`)
|
|
110
112
|
.append ($("<div></div>")
|
|
111
113
|
.attr ("id", id)
|
|
@@ -120,4 +122,7 @@ module .exports = class Tabs extends Interface
|
|
|
120
122
|
|
|
121
123
|
initTab ()
|
|
122
124
|
{ }
|
|
125
|
+
|
|
126
|
+
tabActivated ()
|
|
127
|
+
{ }
|
|
123
128
|
};
|