sunrize 2.0.3 → 2.0.4

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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/Undo/Editor.js +33 -12
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -91,7 +91,7 @@
91
91
  "@vscode/codicons": "^0.0.44",
92
92
  "capitalize": "^2.0.4",
93
93
  "console": "^0.7.2",
94
- "electron": "^40.4.1",
94
+ "electron": "^40.6.0",
95
95
  "electron-prompt": "^1.7.0",
96
96
  "electron-squirrel-startup": "^1.0.1",
97
97
  "electron-tabs": "^1.0.4",
@@ -110,7 +110,7 @@
110
110
  "string-similarity": "^4.0.4",
111
111
  "tweakpane": "^3.1.10",
112
112
  "update-electron-app": "^3.1.2",
113
- "x_ite": "^14.0.3",
113
+ "x_ite": "^14.0.4",
114
114
  "x3d-traverse": "^1.0.22"
115
115
  }
116
116
  }
@@ -616,6 +616,9 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
616
616
  }
617
617
  }
618
618
 
619
+ if (node ._url .equals (newURL))
620
+ return;
621
+
619
622
  const uniqueURL = new X3D .MFString (... new Set (newURL));
620
623
 
621
624
  this .setFieldValue (executionContext, node, node ._url, uniqueURL, undoManager);
@@ -675,16 +678,19 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
675
678
  */
676
679
  static getUsedComponents (scene)
677
680
  {
678
- const components = new Set ();
681
+ const components = new Map ();
679
682
 
680
683
  for (const object of scene .traverse (Traverse .PROTO_DECLARATIONS | Traverse .PROTO_DECLARATION_BODY | Traverse .ROOT_NODES | Traverse .PROTOTYPE_INSTANCES))
681
684
  {
682
685
  if (!(object instanceof X3D .SFNode))
683
686
  continue;
684
687
 
685
- const node = object .getValue ();
688
+ const
689
+ node = object .getValue (),
690
+ componentInfo = node .getComponentInfo ();
686
691
 
687
- components .add (node .getComponentInfo () .name);
692
+ if (components .get (componentInfo .name) ?? 0 < componentInfo .level)
693
+ components .set (componentInfo .name, componentInfo .level);
688
694
  }
689
695
 
690
696
  return components;
@@ -692,31 +698,46 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
692
698
 
693
699
  static getProfileAndComponentsFromUsedComponents (browser, usedComponents)
694
700
  {
695
- const profiles = ["Interactive", "Interchange", "Immersive", "Full"] .map (name =>
701
+ const profiles = ["Interchange", "Interactive", "Immersive", "Full"] .map (name =>
696
702
  {
697
- return { profile: browser .getProfile (name), components: new Set (usedComponents) };
703
+ return { profile: browser .getProfile (name), components: new Map (usedComponents) };
698
704
  });
699
705
 
700
- profiles .forEach (object =>
706
+ profiles .forEach (({ profile, components }) =>
701
707
  {
702
- for (const component of object .profile .components)
703
- object .components .delete (component .name);
708
+ for (const component of profile .components)
709
+ {
710
+ const level = components .get (component .name);
711
+
712
+ if (level === undefined)
713
+ continue;
714
+
715
+ if (level > component .level)
716
+ continue;
717
+
718
+ components .delete (component .name);
719
+ }
704
720
  });
705
721
 
706
722
  const min = profiles .reduce ((min, object) =>
707
723
  {
708
- const count = object .profile .components .length + object .components .size;
724
+ const count = new Set ([
725
+ ... [... object .profile .components] .map (component => component .name),
726
+ ... object .components .keys ()
727
+ ]) .size;
709
728
 
710
729
  return min .count < count ? min : {
711
- count: count,
712
- object: object,
730
+ count,
731
+ object,
713
732
  };
714
733
  },
715
734
  { count: Number .POSITIVE_INFINITY });
716
735
 
717
736
  return {
718
737
  profile: min .object .profile,
719
- components: Array .from (min .object .components) .sort () .map (name => browser .getSupportedComponents () .get (name)),
738
+ components: Array .from (min .object .components .keys ())
739
+ .sort ()
740
+ .map (name => browser .getComponent (name)),
720
741
  };
721
742
  }
722
743