sunrize 1.5.13 → 1.6.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.
Files changed (41) hide show
  1. package/package.json +5 -5
  2. package/src/Application/Application.js +2 -7
  3. package/src/Application/Dashboard.js +10 -10
  4. package/src/Application/DataStorage.js +177 -177
  5. package/src/Application/Document.js +72 -127
  6. package/src/Application/Interface.js +4 -0
  7. package/src/Application/Tabs.js +3 -3
  8. package/src/Controls/Dialog.js +3 -1
  9. package/src/Editors/BrowserFrame.js +171 -0
  10. package/src/Editors/OutlineEditor.js +149 -123
  11. package/src/Editors/OutlineRouteGraph.js +493 -493
  12. package/src/Editors/OutlineView.js +102 -64
  13. package/src/Editors/SceneProperties.js +137 -136
  14. package/src/Editors/ScriptEditor.js +1 -1
  15. package/src/Tools/Core/X3DNodeTool.js +66 -12
  16. package/src/Tools/Grids/AngleGridTool.js +0 -5
  17. package/src/Tools/Grids/AngleGridTool.x3d +1 -0
  18. package/src/Tools/Grids/AxonometricGrid.x3d +5 -5
  19. package/src/Tools/Grids/AxonometricGridTool.js +0 -5
  20. package/src/Tools/Grids/AxonometricGridTool.x3d +1 -0
  21. package/src/Tools/Grids/GridTool.js +0 -5
  22. package/src/Tools/Grids/GridTool.x3d +1 -0
  23. package/src/Tools/Grids/X3DGridNodeTool.js +131 -84
  24. package/src/Tools/Grouping/X3DTransformNodeTool.js +19 -21
  25. package/src/Tools/Grouping/X3DTransformNodeTool.x3d +20 -15
  26. package/src/Tools/Layering/X3DActiveLayerNodeTool.js +16 -21
  27. package/src/Tools/Lighting/DirectionalLightTool.js +32 -1
  28. package/src/Tools/Lighting/X3DLightNodeTool.x3d +4 -21
  29. package/src/Tools/Shaders/TextureShader.x3d +16 -3
  30. package/src/Tools/SnapTool/{SnapSourceTool.js → SnapSource.js} +2 -7
  31. package/src/Tools/SnapTool/SnapTarget.js +650 -0
  32. package/src/Tools/SnapTool/SnapTool.x3d +28 -27
  33. package/src/Tools/SnapTool/X3DSnapNodeTool.js +16 -15
  34. package/src/Tools/Sound/SoundTool.x3d +4 -21
  35. package/src/Tools/TextureProjection/X3DTextureProjectorNodeTool.x3d +19 -26
  36. package/src/Undo/Editor.js +185 -46
  37. package/src/assets/Info.plist +56 -56
  38. package/src/assets/themes/default-template.css +1 -0
  39. package/src/assets/themes/default.css +1 -0
  40. package/src/Editors/BrowserSize.js +0 -101
  41. package/src/Tools/SnapTool/SnapTargetTool.js +0 -20
@@ -37,6 +37,10 @@ module .exports = class Document extends Interface
37
37
  */
38
38
  async initialize ()
39
39
  {
40
+ this .browser ._activeLayer .addInterest ("toggleGrids", this);
41
+
42
+ // Restore
43
+
40
44
  await this .restoreFile ();
41
45
 
42
46
  // Actions
@@ -86,7 +90,7 @@ module .exports = class Document extends Interface
86
90
 
87
91
  // Layout Menu
88
92
 
89
- electron .ipcRenderer .on ("browser-size", () => this .browserSize .open ());
93
+ electron .ipcRenderer .on ("browser-frame", () => this .browserFrame .open ());
90
94
  electron .ipcRenderer .on ("grid-tool", (event, typeName, visible) => this .activateGridTool (typeName, visible));
91
95
  electron .ipcRenderer .on ("grid-options", () => this .showGridOptions ());
92
96
 
@@ -98,16 +102,17 @@ module .exports = class Document extends Interface
98
102
 
99
103
  // Browser Size
100
104
 
101
- this .fullname = await electron .ipcRenderer .invoke ("fullname");
102
- this .browserSize = require ("../Editors/BrowserSize");
103
- this .resizeObserver = new ResizeObserver (() => this .onresize ());
104
-
105
- this .resizeObserver .observe ($("#browser-frame") [0]);
105
+ this .fullname = await electron .ipcRenderer .invoke ("fullname");
106
+ this .browserFrame = require ("../Editors/BrowserFrame");
106
107
 
107
108
  // Change undo menu items.
108
109
 
109
110
  UndoManager .shared .addInterest (this, () => this .undoManager ());
110
111
 
112
+ // Configure browser options.
113
+
114
+ this .browser .setBrowserOption ("MetadataReference", require ("../../package.json") .homepage);
115
+
111
116
  // Connect browser options.
112
117
 
113
118
  this .browser .getBrowserOptions () .getField ("PrimitiveQuality") .addInterest ("set_primitiveQuality", this);
@@ -122,12 +127,6 @@ module .exports = class Document extends Interface
122
127
  .on ("mouseup", event => this .onmouseup (event));
123
128
  }
124
129
 
125
- static #Grids = [
126
- "GridTool",
127
- "AngleGridTool",
128
- "AxonometricGridTool",
129
- ];
130
-
131
130
  configure ()
132
131
  {
133
132
  this .config .file .setDefaultValues ({
@@ -154,17 +153,6 @@ module .exports = class Document extends Interface
154
153
  this .#grids .clear ();
155
154
  this .#gridFields .clear ();
156
155
 
157
- if (this .browser .currentScene !== this .initialScene)
158
- {
159
- for (const typeName of Document .#Grids)
160
- {
161
- const config = this .config .file .addNameSpace (`${typeName}.`);
162
-
163
- if (config .visible)
164
- this .activateGridTool (typeName, true);
165
- }
166
- }
167
-
168
156
  // Remove Snap Target and Snap Source.
169
157
 
170
158
  this .#snapTarget ?.dispose ();
@@ -340,14 +328,19 @@ Viewpoint {
340
328
 
341
329
  // Add default meta data.
342
330
 
343
- const pkg = require ("../../package.json");
331
+ const
332
+ pkg = require ("../../package.json"),
333
+ generator = scene .getMetaData ("generator") ?.filter (value => !value .startsWith (pkg .productName)) ?? [ ];
334
+
335
+ generator .push (`${pkg .productName} V${pkg .version}, ${pkg .homepage}`);
344
336
 
345
337
  if (!scene .getMetaData ("created"))
346
338
  scene .setMetaData ("created", new Date () .toUTCString ());
347
339
 
348
- scene .setMetaData ("comment", `Rise and Shine`);
349
- scene .setMetaData ("creator", this .fullname);
350
- scene .setMetaData ("generator", `${pkg .productName} V${pkg .version}, ${pkg .homepage}`);
340
+ if (!scene .getMetaData ("creator") ?.some (value => value .includes (this .fullname)))
341
+ scene .addMetaData ("creator", this .fullname);
342
+
343
+ scene .setMetaData ("generator", generator);
351
344
  scene .setMetaData ("modified", new Date () .toUTCString ());
352
345
 
353
346
  // Save source code.
@@ -452,7 +445,7 @@ Viewpoint {
452
445
 
453
446
  clearTimeout (this .#saveTimeoutId);
454
447
 
455
- this .#saveTimeoutId = setTimeout (() => this .saveFile (), 1000);
448
+ this .#saveTimeoutId = setTimeout (() => this .saveFile (false), 1000);
456
449
  }
457
450
 
458
451
  exportAs (filePath)
@@ -462,7 +455,7 @@ Viewpoint {
462
455
 
463
456
  close ()
464
457
  {
465
- this .saveFile ();
458
+ this .saveFile (false);
466
459
 
467
460
  electron .ipcRenderer .sendToHost ("closed");
468
461
  }
@@ -649,67 +642,64 @@ Viewpoint {
649
642
  * Layout Menu
650
643
  */
651
644
 
652
- /**
653
- * Change browser size according to aspect-ratio.
654
- */
655
- onresize ()
645
+ static #Grids = [
646
+ "GridTool",
647
+ "AngleGridTool",
648
+ "AxonometricGridTool",
649
+ ];
650
+
651
+ #grids = new Map ();
652
+ #gridFields = new Map ();
653
+
654
+ toggleGrids ()
656
655
  {
657
- const
658
- enabled = this .browserSize .config .file .enabled,
659
- numerator = this .browserSize .config .file .numerator,
660
- denominator = this .browserSize .config .file .denominator,
661
- aspectRatio = numerator / denominator,
662
- frameAspectRatio = $("#browser-frame") .width () / $("#browser-frame") .height (),
663
- element = $(this .browser .element);
664
-
665
- if (enabled && aspectRatio)
666
- {
667
- element .css ({ "aspect-ratio": `${numerator} / ${denominator}` });
656
+ const configNode = Editor .getConfigNode (this .browser);
668
657
 
669
- if (aspectRatio > frameAspectRatio)
670
- element .css ({ "width": "100%", "height": "auto" });
671
- else
672
- element .css ({ "width": "auto", "height": "100%" });
673
- }
674
- else
658
+ for (const typeName of Document .#Grids)
675
659
  {
676
- element .css ({ "aspect-ratio": "unset", "width": "100%", "height": "100%" });
660
+ const [visible = false] = configNode ?.getMetaData (`Sunrize/${typeName}/visible`) ?? [ ];
661
+
662
+ if (!this .#grids .has (typeName) && !visible)
663
+ continue;
664
+
665
+ this .activateGridTool (typeName, visible, false);
677
666
  }
678
667
  }
679
668
 
680
- #grids = new Map ();
681
- #gridFields = new Map ();
682
-
683
- async activateGridTool (typeName, visible)
669
+ async activateGridTool (typeName, visible, undo = true)
684
670
  {
685
671
  const
686
- Tool = require (`../Tools/Grids/${typeName}`),
687
- grid = this .#grids .get (typeName) ?? new Tool (this .browser .currentScene),
688
- config = this .config .file .addNameSpace (`${typeName}.`),
689
- tool = await grid .getToolInstance ();
672
+ Tool = require (`../Tools/Grids/${typeName}`),
673
+ grid = this .#grids .get (typeName) ?? new Tool (this .browser .currentScene),
674
+ tool = await grid .getToolInstance ();
675
+
676
+ grid ._visible .addInterest ("updateMenu", this);
677
+ tool .getField ("isActive") .addInterest ("handleUndoForGrid", this, typeName);
678
+
679
+ UndoManager .shared .beginUndo (_ ("Change Visibility of %s"), typeName);
690
680
 
691
- for (const [typeName, grid] of this .#grids)
681
+ if (visible)
692
682
  {
693
- grid ._visible = false;
694
- this .config .file .addNameSpace (`${typeName}.`) .visible = false;
683
+ for (const [typeName, grid] of this .#grids)
684
+ {
685
+ if (undo)
686
+ Editor .setFieldValue (this .browser .currentScene, grid .tool .getValue (), grid ._visible, false);
687
+ else
688
+ grid ._visible = false;
689
+ }
695
690
  }
696
691
 
697
692
  this .#grids .set (typeName, grid);
698
- grid ._visible = visible;
699
- config .visible = visible;
700
693
 
701
- this .restoreGridTool (typeName);
702
- this .updateMenu ();
703
-
704
- // if (this .secondaryToolbar .config .file .panel)
705
- // this .showGridOptions ();
694
+ if (undo)
695
+ Editor .setFieldValue (this .browser .currentScene, grid .tool .getValue (), grid ._visible, visible);
696
+ else
697
+ grid ._visible = visible;
706
698
 
707
- tool .getValue () .addInterest ("set_gridTool", this, typeName);
708
- tool .getField ("isActive") .addInterest ("set_gridTool", this, typeName);
709
- tool .getField ("isActive") .addInterest ("set_gridTool_active", this, typeName);
699
+ UndoManager .shared .endUndo ();
710
700
  }
711
701
 
712
- async set_gridTool_active (typeName)
702
+ async handleUndoForGrid (typeName)
713
703
  {
714
704
  const
715
705
  grid = this .#grids .get (typeName),
@@ -725,7 +715,7 @@ Viewpoint {
725
715
  {
726
716
  const
727
717
  executionContext = tool .getValue () .getExecutionContext (),
728
- saved = this .#gridFields .get (typeName);
718
+ initialValues = this .#gridFields .get (typeName);
729
719
 
730
720
  UndoManager .shared .beginUndo (_("Change Properties of %s"), typeName);
731
721
 
@@ -734,9 +724,14 @@ Viewpoint {
734
724
  if (!field .isInitializable ())
735
725
  continue;
736
726
 
727
+ const initialValue = initialValues .get (field .getName ());
728
+
729
+ if (field .equals (initialValue))
730
+ continue;
731
+
737
732
  const value = field .copy ();
738
733
 
739
- field .assign (saved .get (field .getName ()));
734
+ field .assign (initialValue);
740
735
 
741
736
  Editor .setFieldValue (executionContext, tool .getValue (), field, value);
742
737
  }
@@ -745,53 +740,6 @@ Viewpoint {
745
740
  }
746
741
  }
747
742
 
748
- async set_gridTool (typeName)
749
- {
750
- const
751
- grid = this .#grids .get (typeName),
752
- tool = await grid .getToolInstance ();
753
-
754
- if (tool .isActive)
755
- return;
756
-
757
- this .saveGridTool (typeName);
758
- }
759
-
760
- async restoreGridTool (typeName)
761
- {
762
- const
763
- grid = this .#grids .get (typeName),
764
- config = this .config .file .addNameSpace (`${typeName}.`),
765
- tool = await grid .getToolInstance ();
766
-
767
- for (const field of tool .getValue () .getFields ())
768
- {
769
- if (!field .isInitializable ())
770
- continue;
771
-
772
- const value = config [field .getName ()];
773
-
774
- if (value !== undefined)
775
- field .fromString (value);
776
- }
777
- }
778
-
779
- async saveGridTool (typeName)
780
- {
781
- const
782
- grid = this .#grids .get (typeName),
783
- config = this .config .file .addNameSpace (`${typeName}.`),
784
- tool = await grid .getToolInstance ();
785
-
786
- for (const field of tool .getValue () .getFields ())
787
- {
788
- if (!field .isInitializable ())
789
- continue;
790
-
791
- config [field .getName ()] = field .toString ();
792
- }
793
- }
794
-
795
743
  updateGridMenus (menu)
796
744
  {
797
745
  Document .#Grids .forEach (typeName => menu [typeName] = false);
@@ -818,9 +766,6 @@ Viewpoint {
818
766
 
819
767
  async onmousedown (event)
820
768
  {
821
- if (process .env .SUNRISE_ENVIRONMENT !== "DEVELOPMENT")
822
- return;
823
-
824
769
  if (event .button !== 2)
825
770
  return;
826
771
 
@@ -870,7 +815,7 @@ Viewpoint {
870
815
 
871
816
  activateSnapTarget (visible)
872
817
  {
873
- const SnapTarget = require ("../Tools/SnapTool/SnapTargetTool");
818
+ const SnapTarget = require ("../Tools/SnapTool/SnapTarget");
874
819
 
875
820
  this .#snapTarget ??= new SnapTarget (this .browser .currentScene);
876
821
 
@@ -881,7 +826,7 @@ Viewpoint {
881
826
 
882
827
  activateSnapSource (visible)
883
828
  {
884
- const SnapSource = require ("../Tools/SnapTool/SnapSourceTool");
829
+ const SnapSource = require ("../Tools/SnapTool/SnapSource");
885
830
 
886
831
  this .#snapSource ??= new SnapSource (this .browser .currentScene);
887
832
 
@@ -14,6 +14,10 @@ require ("../Bits/Beep");
14
14
 
15
15
  Object .assign ($,
16
16
  {
17
+ sleep (ms)
18
+ {
19
+ return new Promise (resolve => setTimeout (resolve, ms));
20
+ },
17
21
  try (callback, logError = false)
18
22
  {
19
23
  try
@@ -91,7 +91,7 @@ module .exports = new class Tabs
91
91
  this .forwardToActiveTab ("display-timings");
92
92
  this .forwardToActiveTab ("show-library");
93
93
 
94
- this .forwardToActiveTab ("browser-size");
94
+ this .forwardToActiveTab ("browser-frame");
95
95
  this .forwardToActiveTab ("grid-tool");
96
96
  this .forwardToActiveTab ("grid-options");
97
97
  this .forwardToActiveTab ("activate-snap-target");
@@ -365,11 +365,11 @@ module .exports = new class Tabs
365
365
 
366
366
  forwardToActiveTab (channel)
367
367
  {
368
- electron .ipcRenderer .on (channel, (event, ...args) => this .tabs .getActiveTab () .webview .send (channel, ...args));
368
+ electron .ipcRenderer .on (channel, (event, ... args) => this .tabs .getActiveTab () .webview .send (channel, ... args));
369
369
  }
370
370
 
371
371
  forwardToAllTabs (channel)
372
372
  {
373
- electron .ipcRenderer .on (channel, (event, ...args) => this .tabs .getTabs () .forEach (tab => tab .webview .send (channel, ...args)));
373
+ electron .ipcRenderer .on (channel, (event, ... args) => this .tabs .getTabs () .forEach (tab => tab .webview .send (channel, ... args)));
374
374
  }
375
375
  };
@@ -57,7 +57,9 @@ module .exports = class Dialog extends Interface
57
57
  open ()
58
58
  {
59
59
  this .element .dialog ({
60
- position: { ...this .config .file .position, of: $("body") },
60
+ position: { ... this .config .file .position, of: $("body") },
61
+ minWidth: this .config .file .getDefaultValue ("size") [0],
62
+ minHeight: this .config .file .getDefaultValue ("size") [1],
61
63
  width: this .config .file .size [0],
62
64
  height: this .config .file .size [1],
63
65
  })
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+
3
+ const
4
+ $ = require ("jquery"),
5
+ X3D = require ("../X3D"),
6
+ Dialog = require ("../Controls/Dialog"),
7
+ Editor = require ("../Undo/Editor"),
8
+ UndoManager = require ("../Undo/UndoManager"),
9
+ _ = require ("../Application/GetText");
10
+
11
+ module .exports = new class BrowserFrame extends Dialog
12
+ {
13
+ constructor ()
14
+ {
15
+ super ("Sunrize.BrowserFrame.");
16
+
17
+ this .setup ();
18
+ }
19
+
20
+ initialize ()
21
+ {
22
+ super .initialize ();
23
+
24
+ // Add class.
25
+
26
+ this .element .addClass ("browser-frame");
27
+
28
+ this .table = $("<table></table>") .appendTo (this .element);
29
+ this .table .header = $("<thead></thead>") .appendTo (this .table);
30
+ this .table .body = $("<tbody></tbody>") .appendTo (this .table);
31
+
32
+ $("<tr></tr>")
33
+ .append ($("<th></th>")
34
+ .attr ("colspan", "2")
35
+ .text (_("Browser Frame")))
36
+ .appendTo (this .table .header);
37
+
38
+ this .fixedSize = $("<input></input>")
39
+ .attr ("id", "browser-frame-fixed-size")
40
+ .attr ("type", "checkbox")
41
+ .on ("change", () => this .onchange ());
42
+
43
+ $("<tr></tr>")
44
+ .append ($("<th></th>"))
45
+ .append ($("<td></td>")
46
+ .append (this .fixedSize)
47
+ .append ($("<label></label>")
48
+ .attr ("for", "browser-frame-fixed-size")
49
+ .text (_("Fixed Size"))))
50
+ .appendTo (this .table .body);
51
+
52
+ this .numerator = $("<input></input>")
53
+ .attr ("type", "number")
54
+ .attr ("step", "1")
55
+ .css ("width", "calc((100% - 20px) / 2)")
56
+ .on ("change", () => this .onchange ());
57
+
58
+ const slash = $("<span></span>")
59
+ .css ({ "display": "inline-block", "width": "20px", "text-align": "center" })
60
+ .text ("/");
61
+
62
+ this .denominator = $("<input></input>")
63
+ .attr ("type", "number")
64
+ .attr ("step", "1")
65
+ .css ("width", "calc((100% - 20px) / 2)")
66
+ .on ("change", () => this .onchange ());
67
+
68
+ $("<tr></tr>")
69
+ .append ($("<th></th>")
70
+ .text (_("Aspect Ratio")))
71
+ .append ($("<td></td>")
72
+ .append (this .numerator)
73
+ .append (slash)
74
+ .append (this .denominator))
75
+ .appendTo (this .table .body);
76
+
77
+ this .backgroundColor = $("<input></input>")
78
+ .attr ("title", _("A background color which is applied to the <x3d-canvas> element."))
79
+ .attr ("placeholder", "Enter any CSS color here.")
80
+ .on ("change", () => this .onchange ());
81
+
82
+ $("<tr></tr>")
83
+ .append ($("<th></th>") .text (_("Background Color")))
84
+ .append ($("<td></td>") .append (this .backgroundColor))
85
+ .appendTo (this .table .body);
86
+
87
+ this .resizeObserver = new ResizeObserver (() => this .onresize ());
88
+
89
+ this .resizeObserver .observe ($("#browser-frame") [0]);
90
+ }
91
+
92
+ configure ()
93
+ {
94
+ super .configure ({ size: [400, 127] });
95
+
96
+ this .connect (Editor .getWorldInfo (this .browser .currentScene));
97
+ this .updateInputs ();
98
+ }
99
+
100
+ connect (worldInfoNode)
101
+ {
102
+ worldInfoNode ?.addMetaDataCallback (this, "Sunrize/BrowserFrame/fixedSize", () => this .updateInputs ());
103
+ worldInfoNode ?.addMetaDataCallback (this, "Sunrize/BrowserFrame/aspectRatio", () => this .updateInputs ());
104
+ worldInfoNode ?.addMetaDataCallback (this, "Sunrize/BrowserFrame/backgroundColor", () => this .updateInputs ());
105
+ }
106
+
107
+ updateInputs ()
108
+ {
109
+ const
110
+ worldInfoNode = Editor .getWorldInfo (this .browser .currentScene),
111
+ [fixedSize = false] = worldInfoNode ?.getMetaData ("Sunrize/BrowserFrame/fixedSize") ?? [ ],
112
+ [numerator = 1, denominator = 1] = worldInfoNode ?.getMetaData ("Sunrize/BrowserFrame/aspectRatio") ?? [ ],
113
+ [backgroundColor = ""] = worldInfoNode ?.getMetaData ("Sunrize/BrowserFrame/backgroundColor") ?? [ ];
114
+
115
+ this .fixedSize .prop ("checked", fixedSize);
116
+ this .numerator .val (numerator);
117
+ this .denominator .val (denominator);
118
+ this .backgroundColor .val (backgroundColor);
119
+ }
120
+
121
+ onchange ()
122
+ {
123
+ const
124
+ worldInfoNode = Editor .getWorldInfo (this .browser .currentScene, true),
125
+ fixedSize = new X3D .SFBool (this .fixedSize .prop ("checked")),
126
+ aspectRatio = new X3D .MFDouble (this .numerator .val (), this .denominator .val ()),
127
+ backgroundColor = new X3D .SFString (this .backgroundColor .val ());
128
+
129
+ this .connect (worldInfoNode);
130
+
131
+ UndoManager .shared .beginUndo (_("Change Browser Frame"));
132
+
133
+ Editor .setNodeMetaData (worldInfoNode, "Sunrize/BrowserFrame/fixedSize", fixedSize);
134
+ Editor .setNodeMetaData (worldInfoNode, "Sunrize/BrowserFrame/aspectRatio", aspectRatio);
135
+ Editor .setNodeMetaData (worldInfoNode, "Sunrize/BrowserFrame/backgroundColor", backgroundColor);
136
+ Editor .deferFunction (() => this .onresize ());
137
+
138
+ UndoManager .shared .endUndo ();
139
+ }
140
+
141
+ /**
142
+ * Change browser size according to aspect-ratio.
143
+ */
144
+ onresize ()
145
+ {
146
+ const
147
+ worldInfoNode = Editor .getWorldInfo (this .browser .currentScene),
148
+ [fixedSize = false] = worldInfoNode ?.getMetaData ("Sunrize/BrowserFrame/fixedSize") ?? [ ],
149
+ [numerator = 1, denominator = 1] = worldInfoNode ?.getMetaData ("Sunrize/BrowserFrame/aspectRatio") ?? [ ],
150
+ [backgroundColor = ""] = worldInfoNode ?.getMetaData ("Sunrize/BrowserFrame/backgroundColor") ?? [ ],
151
+ aspectRatio = numerator / denominator,
152
+ frameAspectRatio = $("#browser-frame") .width () / $("#browser-frame") .height (),
153
+ element = $(this .browser .element);
154
+
155
+ if (fixedSize && aspectRatio)
156
+ {
157
+ element .css ({ "aspect-ratio": `${numerator} / ${denominator}` });
158
+
159
+ if (aspectRatio > frameAspectRatio)
160
+ element .css ({ "width": "100%", "height": "auto" });
161
+ else
162
+ element .css ({ "width": "auto", "height": "100%" });
163
+ }
164
+ else
165
+ {
166
+ element .css ({ "aspect-ratio": "unset", "width": "100%", "height": "100%" });
167
+ }
168
+
169
+ element .css ("background-color", `${backgroundColor}` .replace (/\b(?:transparent|unset|initial)\b/g, ""));
170
+ }
171
+ };