sunrize 1.7.44 → 1.7.46
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 +12 -12
- package/src/Application/Document.js +1 -9
- package/src/Components/Geometry2D/Arc2D.js +16 -0
- package/src/Components/Geometry2D/ArcClose2D.js +14 -0
- package/src/Components/Geometry2D/Circle2D.js +23 -0
- package/src/Components/Geometry2D/Disk2D.js +53 -0
- package/src/Components/Geometry2D/Polyline2D.js +16 -0
- package/src/Components/Geometry2D/Polypoint2D.js +20 -0
- package/src/Components/Geometry2D/Rectangle2D.js +27 -0
- package/src/Components/Geometry2D/TriangleSet2D.js +33 -0
- package/src/Components/Geometry3D/Box.js +27 -0
- package/src/Components/Geometry3D/Cone.js +79 -0
- package/src/Components/Geometry3D/Cylinder.js +81 -0
- package/src/Components/Geometry3D/ElevationGrid.js +23 -0
- package/src/Components/Geometry3D/Extrusion.js +194 -0
- package/src/Components/Geometry3D/IndexedFaceSet.js +158 -0
- package/src/Components/Geometry3D/Sphere.js +27 -0
- package/src/Components/NURBS/NurbsCurve.js +17 -0
- package/src/Components/NURBS/NurbsSweptSurface.js +24 -0
- package/src/Components/NURBS/NurbsSwungSurface.js +24 -0
- package/src/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +19 -0
- package/src/Components/Rendering/IndexedLineSet.js +24 -0
- package/src/Components/Rendering/LineSet.js +34 -0
- package/src/Components/Rendering/X3DComposedGeometryNode.js +44 -0
- package/src/Components/Rendering/X3DGeometryNode.js +195 -0
- package/src/Components/Text/Text.js +17 -0
- package/src/Components.js +33 -0
- package/src/Editors/OutlineEditor.js +183 -18
- package/src/Editors/OutlineView.js +3 -3
- package/src/Editors/ScriptEditor.js +79 -17
- package/src/Tools/Geometry2D/Disk2DTool.js +16 -18
- package/src/Undo/Editor.js +198 -144
|
@@ -248,7 +248,11 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
248
248
|
args: ["addUserDefinedField", element .attr ("id"), executionContext .getId (), node .getId ()],
|
|
249
249
|
},
|
|
250
250
|
{ type: "separator" },
|
|
251
|
-
|
|
251
|
+
];
|
|
252
|
+
|
|
253
|
+
if (node .getType () .includes (X3D .X3DConstants .X3DChildNode))
|
|
254
|
+
{
|
|
255
|
+
menu .push ({
|
|
252
256
|
label: _("Add Parent Group"),
|
|
253
257
|
submenu: [
|
|
254
258
|
{
|
|
@@ -358,8 +362,8 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
358
362
|
enabled: parentNodeElement .hasClass ("node"),
|
|
359
363
|
args: ["removeParent", element .attr ("id"), executionContext .getId (), node .getId ()],
|
|
360
364
|
},
|
|
361
|
-
{ type: "separator" }
|
|
362
|
-
|
|
365
|
+
{ type: "separator" });
|
|
366
|
+
}
|
|
363
367
|
|
|
364
368
|
for (const type of node .getType () .toReversed ())
|
|
365
369
|
{
|
|
@@ -386,6 +390,28 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
386
390
|
|
|
387
391
|
continue;
|
|
388
392
|
}
|
|
393
|
+
case X3D .X3DConstants .X3DGeometryNode:
|
|
394
|
+
{
|
|
395
|
+
if (node .toIndexedTriangleSet)
|
|
396
|
+
{
|
|
397
|
+
menu .push (
|
|
398
|
+
{
|
|
399
|
+
label: _("Convert Node to IndexedTriangleSet"),
|
|
400
|
+
args: ["toIndexedTriangleSet", element .attr ("id"), executionContext .getId (), node .getId ()],
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (node .toPrimitive)
|
|
405
|
+
{
|
|
406
|
+
menu .push (
|
|
407
|
+
{
|
|
408
|
+
label: _("Convert Node to Next Lower Geometry Type"),
|
|
409
|
+
args: ["toPrimitive", element .attr ("id"), executionContext .getId (), node .getId ()],
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
389
415
|
case X3D .X3DConstants .ImageTexture:
|
|
390
416
|
{
|
|
391
417
|
if (node .checkLoadState () === X3D .X3DConstants .COMPLETE_STATE)
|
|
@@ -432,6 +458,11 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
432
458
|
}
|
|
433
459
|
case X3D .X3DConstants .X3DPrototypeInstance:
|
|
434
460
|
{
|
|
461
|
+
menu .push ({
|
|
462
|
+
label: _("Unwrap Inner Node"),
|
|
463
|
+
args: ["unwrapInnerNode", element .attr ("id"), executionContext .getId (), node .getId ()],
|
|
464
|
+
});
|
|
465
|
+
|
|
435
466
|
if (!$.try (() => node .getInnerNode () .getType () .includes (X3D .X3DConstants .X3DChildNode)))
|
|
436
467
|
continue;
|
|
437
468
|
|
|
@@ -1051,6 +1082,9 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1051
1082
|
}
|
|
1052
1083
|
|
|
1053
1084
|
UndoManager .shared .endUndo ();
|
|
1085
|
+
|
|
1086
|
+
if (element .hasClass ("selected"))
|
|
1087
|
+
require ("../Application/Selection") .add (primitive);
|
|
1054
1088
|
}
|
|
1055
1089
|
|
|
1056
1090
|
async addParentGroup (id, executionContextId, nodeId, component, typeName, fieldName)
|
|
@@ -1682,39 +1716,53 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1682
1716
|
case X3D .X3DConstants .IndexedFaceSet:
|
|
1683
1717
|
{
|
|
1684
1718
|
const
|
|
1685
|
-
polygons = node .triangulate (),
|
|
1686
1719
|
coordIndex = node ._coordIndex,
|
|
1687
1720
|
normalPerVertex = node ._normalPerVertex .getValue (),
|
|
1721
|
+
polygons = node .triangulate (),
|
|
1688
1722
|
normals = node .createNormals (polygons),
|
|
1689
|
-
normalIndex = new X3D .MFInt32 (),
|
|
1690
1723
|
normalNode = executionContext .createNode ("Normal") .getValue (),
|
|
1691
1724
|
vector = normalNode ._vector;
|
|
1692
1725
|
|
|
1693
1726
|
if (normalPerVertex)
|
|
1694
1727
|
{
|
|
1695
|
-
|
|
1696
|
-
{
|
|
1697
|
-
const index = coordIndex [i];
|
|
1728
|
+
const creaseAngle = X3D .Algorithm .clamp (node ._creaseAngle .getValue (), 0, Math .PI);
|
|
1698
1729
|
|
|
1699
|
-
|
|
1730
|
+
if (Math .abs (creaseAngle - Math .PI) < 0.1)
|
|
1731
|
+
{
|
|
1732
|
+
for (const [i, index] of coordIndex .entries ())
|
|
1700
1733
|
{
|
|
1701
|
-
|
|
1734
|
+
if (index < 0)
|
|
1735
|
+
continue;
|
|
1736
|
+
|
|
1737
|
+
vector [index] = normals [i];
|
|
1702
1738
|
}
|
|
1703
|
-
|
|
1739
|
+
}
|
|
1740
|
+
else
|
|
1741
|
+
{
|
|
1742
|
+
const normalIndex = new X3D .MFInt32 ();
|
|
1743
|
+
|
|
1744
|
+
for (const [i, index] of coordIndex .entries ())
|
|
1704
1745
|
{
|
|
1705
|
-
|
|
1706
|
-
|
|
1746
|
+
if (index < 0)
|
|
1747
|
+
{
|
|
1748
|
+
normalIndex .push (-1);
|
|
1749
|
+
}
|
|
1750
|
+
else
|
|
1751
|
+
{
|
|
1752
|
+
normalIndex .push (vector .length);
|
|
1753
|
+
vector .push (normals [i]);
|
|
1754
|
+
}
|
|
1707
1755
|
}
|
|
1756
|
+
|
|
1757
|
+
Editor .setFieldValue (executionContext, node, node ._normalIndex, normalIndex);
|
|
1708
1758
|
}
|
|
1709
1759
|
}
|
|
1710
1760
|
else
|
|
1711
1761
|
{
|
|
1712
1762
|
let face = 0;
|
|
1713
1763
|
|
|
1714
|
-
for (
|
|
1764
|
+
for (const [i, index] of coordIndex .entries ())
|
|
1715
1765
|
{
|
|
1716
|
-
const index = coordIndex [i];
|
|
1717
|
-
|
|
1718
1766
|
if (index < 0)
|
|
1719
1767
|
{
|
|
1720
1768
|
vector .length = ++ face;
|
|
@@ -1726,8 +1774,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1726
1774
|
}
|
|
1727
1775
|
}
|
|
1728
1776
|
|
|
1729
|
-
Editor .setFieldValue (executionContext, node, node .
|
|
1730
|
-
Editor .setFieldValue (executionContext, node, node ._normal, normalNode);
|
|
1777
|
+
Editor .setFieldValue (executionContext, node, node ._normal, normalNode);
|
|
1731
1778
|
break;
|
|
1732
1779
|
}
|
|
1733
1780
|
case X3D .X3DConstants .X3DComposedGeometryNode:
|
|
@@ -1809,6 +1856,124 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
|
|
|
1809
1856
|
UndoManager .shared .endUndo ();
|
|
1810
1857
|
}
|
|
1811
1858
|
|
|
1859
|
+
toIndexedTriangleSet (id, executionContextId, nodeId)
|
|
1860
|
+
{
|
|
1861
|
+
const
|
|
1862
|
+
element = $(`#${id}`),
|
|
1863
|
+
executionContext = this .objects .get (executionContextId),
|
|
1864
|
+
parentFieldElement = element .closest (".field, .scene", this .sceneGraph),
|
|
1865
|
+
parentNodeElement = parentFieldElement .closest (".node, .proto, .scene", this .sceneGraph),
|
|
1866
|
+
parentNode = this .getNode (parentNodeElement),
|
|
1867
|
+
parentField = parentFieldElement .hasClass ("scene") ? parentNode .rootNodes : this .getField (parentFieldElement),
|
|
1868
|
+
node = this .objects .get (nodeId),
|
|
1869
|
+
primitive = node .toIndexedTriangleSet (executionContext),
|
|
1870
|
+
index = parseInt (element .attr ("index"));
|
|
1871
|
+
|
|
1872
|
+
UndoManager .shared .beginUndo (_("Convert Node to IndexedTriangleSet"));
|
|
1873
|
+
|
|
1874
|
+
if (node .getName ())
|
|
1875
|
+
Editor .updateNamedNode (executionContext, executionContext .getUniqueName (node .getName ()), primitive);
|
|
1876
|
+
|
|
1877
|
+
switch (parentField .getType ())
|
|
1878
|
+
{
|
|
1879
|
+
case X3D .X3DConstants .SFNode:
|
|
1880
|
+
{
|
|
1881
|
+
Editor .setFieldValue (executionContext, parentNode, parentField, primitive);
|
|
1882
|
+
break;
|
|
1883
|
+
}
|
|
1884
|
+
case X3D .X3DConstants .MFNode:
|
|
1885
|
+
{
|
|
1886
|
+
Editor .removeValueFromArray (executionContext, parentNode, parentField, index);
|
|
1887
|
+
Editor .insertValueIntoArray (executionContext, parentNode, parentField, index, primitive);
|
|
1888
|
+
break;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
UndoManager .shared .endUndo ();
|
|
1893
|
+
|
|
1894
|
+
if (element .hasClass ("selected"))
|
|
1895
|
+
require ("../Application/Selection") .add (primitive);
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
toPrimitive (id, executionContextId, nodeId)
|
|
1899
|
+
{
|
|
1900
|
+
const
|
|
1901
|
+
element = $(`#${id}`),
|
|
1902
|
+
executionContext = this .objects .get (executionContextId),
|
|
1903
|
+
parentFieldElement = element .closest (".field, .scene", this .sceneGraph),
|
|
1904
|
+
parentNodeElement = parentFieldElement .closest (".node, .proto, .scene", this .sceneGraph),
|
|
1905
|
+
parentNode = this .getNode (parentNodeElement),
|
|
1906
|
+
parentField = parentFieldElement .hasClass ("scene") ? parentNode .rootNodes : this .getField (parentFieldElement),
|
|
1907
|
+
node = this .objects .get (nodeId),
|
|
1908
|
+
primitive = node .toPrimitive (executionContext),
|
|
1909
|
+
index = parseInt (element .attr ("index"));
|
|
1910
|
+
|
|
1911
|
+
UndoManager .shared .beginUndo (_("Convert Node to Next Lower Primitive"));
|
|
1912
|
+
|
|
1913
|
+
if (node .getName ())
|
|
1914
|
+
Editor .updateNamedNode (executionContext, executionContext .getUniqueName (node .getName ()), primitive);
|
|
1915
|
+
|
|
1916
|
+
switch (parentField .getType ())
|
|
1917
|
+
{
|
|
1918
|
+
case X3D .X3DConstants .SFNode:
|
|
1919
|
+
{
|
|
1920
|
+
Editor .setFieldValue (executionContext, parentNode, parentField, primitive);
|
|
1921
|
+
break;
|
|
1922
|
+
}
|
|
1923
|
+
case X3D .X3DConstants .MFNode:
|
|
1924
|
+
{
|
|
1925
|
+
Editor .removeValueFromArray (executionContext, parentNode, parentField, index);
|
|
1926
|
+
Editor .insertValueIntoArray (executionContext, parentNode, parentField, index, primitive);
|
|
1927
|
+
break;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
UndoManager .shared .endUndo ();
|
|
1932
|
+
|
|
1933
|
+
if (element .hasClass ("selected"))
|
|
1934
|
+
require ("../Application/Selection") .add (primitive);
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
async unwrapInnerNode (id, executionContextId, nodeId)
|
|
1938
|
+
{
|
|
1939
|
+
const
|
|
1940
|
+
element = $(`#${id}`),
|
|
1941
|
+
executionContext = this .objects .get (executionContextId),
|
|
1942
|
+
parentFieldElement = element .closest (".field, .scene", this .sceneGraph),
|
|
1943
|
+
parentNodeElement = parentFieldElement .closest (".node, .proto, .scene", this .sceneGraph),
|
|
1944
|
+
parentNode = this .getNode (parentNodeElement),
|
|
1945
|
+
parentField = parentFieldElement .hasClass ("scene") ? parentNode .rootNodes : this .getField (parentFieldElement),
|
|
1946
|
+
node = this .objects .get (nodeId),
|
|
1947
|
+
x3dSyntax = await Editor .exportX3D (this .executionContext, [node]),
|
|
1948
|
+
importedNodes = await Editor .importX3D (this .executionContext, x3dSyntax),
|
|
1949
|
+
innerNode = importedNodes [0],
|
|
1950
|
+
index = parseInt (element .attr ("index"));
|
|
1951
|
+
|
|
1952
|
+
this .executionContext .rootNodes .length -= importedNodes .length;
|
|
1953
|
+
|
|
1954
|
+
UndoManager .shared .beginUndo (_("Convert Node to Next Lower Primitive"));
|
|
1955
|
+
|
|
1956
|
+
switch (parentField .getType ())
|
|
1957
|
+
{
|
|
1958
|
+
case X3D .X3DConstants .SFNode:
|
|
1959
|
+
{
|
|
1960
|
+
Editor .setFieldValue (executionContext, parentNode, parentField, innerNode);
|
|
1961
|
+
break;
|
|
1962
|
+
}
|
|
1963
|
+
case X3D .X3DConstants .MFNode:
|
|
1964
|
+
{
|
|
1965
|
+
Editor .removeValueFromArray (executionContext, parentNode, parentField, index);
|
|
1966
|
+
Editor .insertValueIntoArray (executionContext, parentNode, parentField, index, innerNode);
|
|
1967
|
+
break;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
UndoManager .shared .endUndo ();
|
|
1972
|
+
|
|
1973
|
+
if (element .hasClass ("selected"))
|
|
1974
|
+
require ("../Application/Selection") .add (innerNode);
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1812
1977
|
addPrototype (id, executionContextId)
|
|
1813
1978
|
{
|
|
1814
1979
|
require ("../Controls/AddPrototypePopover");
|
|
@@ -2926,7 +2926,7 @@ module .exports = class OutlineView extends Interface
|
|
|
2926
2926
|
}
|
|
2927
2927
|
});
|
|
2928
2928
|
|
|
2929
|
-
element .find (".node:not([node-id=NULL])") .each ((i, e) =>
|
|
2929
|
+
element .find (".node:not([node-id=NULL]), .imported-node, .exported-node") .each ((i, e) =>
|
|
2930
2930
|
{
|
|
2931
2931
|
const
|
|
2932
2932
|
child = $(e),
|
|
@@ -2975,7 +2975,7 @@ module .exports = class OutlineView extends Interface
|
|
|
2975
2975
|
{
|
|
2976
2976
|
const
|
|
2977
2977
|
child = $(e),
|
|
2978
|
-
node
|
|
2978
|
+
node = this .getNode (child);
|
|
2979
2979
|
|
|
2980
2980
|
node .typeName_changed .removeFieldCallback (this .#exportedNodeSymbol);
|
|
2981
2981
|
node .name_changed .removeFieldCallback (this .#exportedNodeSymbol);
|
|
@@ -2985,7 +2985,7 @@ module .exports = class OutlineView extends Interface
|
|
|
2985
2985
|
{
|
|
2986
2986
|
const
|
|
2987
2987
|
child = $(e),
|
|
2988
|
-
field
|
|
2988
|
+
field = this .getField (child);
|
|
2989
2989
|
|
|
2990
2990
|
field .removeReferencesCallback (this .#fieldSymbol);
|
|
2991
2991
|
field .removeRouteCallback (this .#fieldSymbol);
|
|
@@ -174,8 +174,8 @@ module .exports = class ScriptEditor extends Interface
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
if (this .
|
|
178
|
-
this .
|
|
177
|
+
if (this .editor)
|
|
178
|
+
this .editor .viewState = this .editor .saveViewState ();
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
this .node = node;
|
|
@@ -186,12 +186,12 @@ module .exports = class ScriptEditor extends Interface
|
|
|
186
186
|
|
|
187
187
|
this .nodeName .renameNodeInput (this .node);
|
|
188
188
|
this .applyButton .show ();
|
|
189
|
-
this .
|
|
189
|
+
this .monaco ?.detach ();
|
|
190
190
|
|
|
191
|
-
this .
|
|
192
|
-
this .
|
|
191
|
+
this .monaco = editor .element .appendTo (this .verticalSplitterRight);
|
|
192
|
+
this .editor = editor .editor;
|
|
193
193
|
|
|
194
|
-
this .
|
|
194
|
+
this .editor .restoreViewState (this .editor .viewState);
|
|
195
195
|
|
|
196
196
|
this .node ._url .addFieldCallback (this, this .set_url .bind (this));
|
|
197
197
|
this .node ._loadState .addFieldCallback (this, this .set_loadState .bind (this, editor .monaco));
|
|
@@ -228,10 +228,10 @@ module .exports = class ScriptEditor extends Interface
|
|
|
228
228
|
{
|
|
229
229
|
this .nodeName .renameNodeInput (null, null);
|
|
230
230
|
this .applyButton .hide ();
|
|
231
|
-
this .
|
|
231
|
+
this .monaco ?.detach ();
|
|
232
232
|
|
|
233
|
-
this .editor = null;
|
|
234
233
|
this .monaco = null;
|
|
234
|
+
this .editor = null;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -406,6 +406,17 @@ module .exports = class ScriptEditor extends Interface
|
|
|
406
406
|
editor .onDidFocusEditorWidget (() => this .setDeclarations (monaco));
|
|
407
407
|
editor .onDidBlurEditorWidget (() => this .apply ());
|
|
408
408
|
|
|
409
|
+
editor .onKeyDown ((event) =>
|
|
410
|
+
{
|
|
411
|
+
const { keyCode, ctrlKey, metaKey } = event;
|
|
412
|
+
|
|
413
|
+
if (keyCode === 52 && (metaKey || ctrlKey))
|
|
414
|
+
{
|
|
415
|
+
event .preventDefault ();
|
|
416
|
+
this .paste ();
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
|
|
409
420
|
editor .viewState = editor .saveViewState ();
|
|
410
421
|
|
|
411
422
|
element .on ("mouseenter", () => this .setDeclarations (monaco))
|
|
@@ -467,15 +478,15 @@ module .exports = class ScriptEditor extends Interface
|
|
|
467
478
|
{ type: "separator" },
|
|
468
479
|
{
|
|
469
480
|
label: _("Cut"),
|
|
470
|
-
args: ["
|
|
481
|
+
args: ["cutOrCopy", true],
|
|
471
482
|
},
|
|
472
483
|
{
|
|
473
484
|
label: _("Copy"),
|
|
474
|
-
args: ["
|
|
485
|
+
args: ["cutOrCopy", false],
|
|
475
486
|
},
|
|
476
487
|
{
|
|
477
488
|
label: _("Paste"),
|
|
478
|
-
args: ["
|
|
489
|
+
args: ["paste"],
|
|
479
490
|
},
|
|
480
491
|
{ type: "separator" },
|
|
481
492
|
{
|
|
@@ -489,7 +500,7 @@ module .exports = class ScriptEditor extends Interface
|
|
|
489
500
|
|
|
490
501
|
runAction (id)
|
|
491
502
|
{
|
|
492
|
-
this .
|
|
503
|
+
this .editor .getAction (id) .run ();
|
|
493
504
|
}
|
|
494
505
|
|
|
495
506
|
debugFindActions (editor = this .editor)
|
|
@@ -541,9 +552,60 @@ module .exports = class ScriptEditor extends Interface
|
|
|
541
552
|
}
|
|
542
553
|
}
|
|
543
554
|
|
|
544
|
-
execCommand (command)
|
|
555
|
+
// execCommand (command)
|
|
556
|
+
// {
|
|
557
|
+
// document .execCommand (command);
|
|
558
|
+
// }
|
|
559
|
+
|
|
560
|
+
cutOrCopy (cut)
|
|
561
|
+
{
|
|
562
|
+
this .editor .focus ();
|
|
563
|
+
|
|
564
|
+
// Get the current selection in the editor.
|
|
565
|
+
const selection = this .editor .getSelection ();
|
|
566
|
+
|
|
567
|
+
if (!selection || selection .isEmpty ())
|
|
568
|
+
{
|
|
569
|
+
navigator .clipboard .writeText ("");
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// Get the text from that selection.
|
|
574
|
+
const data = this .editor .getModel () ?.getValueInRange (selection);
|
|
575
|
+
|
|
576
|
+
// Set the clipboard contents.
|
|
577
|
+
navigator .clipboard .writeText (data || "");
|
|
578
|
+
|
|
579
|
+
if (!cut)
|
|
580
|
+
return;
|
|
581
|
+
|
|
582
|
+
// This is a cut operation, so replace the selection with an empty string.
|
|
583
|
+
this .editor .executeEdits ("clipboard", [{
|
|
584
|
+
range: selection,
|
|
585
|
+
text: "",
|
|
586
|
+
forceMoveMarkers: true,
|
|
587
|
+
}]);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async paste ()
|
|
545
591
|
{
|
|
546
|
-
|
|
592
|
+
this .editor .focus ();
|
|
593
|
+
|
|
594
|
+
// Get the current clipboard contents
|
|
595
|
+
const text = await navigator .clipboard .readText ();
|
|
596
|
+
|
|
597
|
+
// Get the current selection in the editor.
|
|
598
|
+
const selection = this .editor .getSelection ();
|
|
599
|
+
|
|
600
|
+
if (!selection)
|
|
601
|
+
return;
|
|
602
|
+
|
|
603
|
+
// Replace the current contents with the text from the clipboard.
|
|
604
|
+
this .editor .executeEdits ("clipboard", [{
|
|
605
|
+
range: selection,
|
|
606
|
+
text: text,
|
|
607
|
+
forceMoveMarkers: true,
|
|
608
|
+
}]);
|
|
547
609
|
}
|
|
548
610
|
|
|
549
611
|
create ()
|
|
@@ -649,11 +711,11 @@ main ()
|
|
|
649
711
|
if (!this .node)
|
|
650
712
|
return;
|
|
651
713
|
|
|
652
|
-
if (!this .
|
|
714
|
+
if (!this .editor)
|
|
653
715
|
return;
|
|
654
716
|
|
|
655
717
|
const
|
|
656
|
-
string = this .
|
|
718
|
+
string = this .editor .getModel () .getValue (),
|
|
657
719
|
value = this .node ._url .toSpliced (0, 1, Editor .encodeURI (string));
|
|
658
720
|
|
|
659
721
|
if (this .node ._url .equals (value))
|
|
@@ -666,7 +728,7 @@ main ()
|
|
|
666
728
|
|
|
667
729
|
set_url ()
|
|
668
730
|
{
|
|
669
|
-
this .
|
|
731
|
+
this .editor .getModel () .setValue (Editor .decodeURI (this .node ._url [0]));
|
|
670
732
|
}
|
|
671
733
|
|
|
672
734
|
set_loadState (monaco)
|
|
@@ -19,58 +19,56 @@ class Disk2DTool extends X3DGeometryNodeTool
|
|
|
19
19
|
|
|
20
20
|
const toolChildren = new X3D .MFNode ();
|
|
21
21
|
|
|
22
|
-
// Transform Tool
|
|
22
|
+
// Transform Tool outerRadius
|
|
23
23
|
{
|
|
24
24
|
const
|
|
25
25
|
groupNode = this .getToolScene () .createNode ("Group"),
|
|
26
26
|
transformNode = this .getToolScene () .createNode ("Transform"),
|
|
27
27
|
transformTool = await transformNode .getValue () .addTool () .getToolInstance ();
|
|
28
28
|
|
|
29
|
-
this .#
|
|
29
|
+
this .#outerRadiusTransformNode = transformNode;
|
|
30
30
|
|
|
31
|
-
transformNode .scale .addInterest ("
|
|
31
|
+
transformNode .scale .addInterest ("set_outerRadiusScale", this);
|
|
32
32
|
transformTool .getField ("isActive") .addInterest ("handleUndo", this);
|
|
33
|
-
transformTool .getField ("isActive") .addInterest ("
|
|
33
|
+
transformTool .getField ("isActive") .addInterest ("set_outerRadiusActive", this);
|
|
34
34
|
|
|
35
35
|
groupNode .bboxSize = new X3D .Vector3 (2, 2, 0);
|
|
36
36
|
transformNode .children = [groupNode];
|
|
37
|
-
transformTool .group = `${this .getTypeName ()}.
|
|
37
|
+
transformTool .group = `${this .getTypeName ()}.outerRadius`;
|
|
38
38
|
transformTool .undo = false;
|
|
39
39
|
transformTool .tools = ["SCALE"];
|
|
40
40
|
transformTool .keys = [ ];
|
|
41
41
|
transformTool .connectedAxes = ["XY", "YX", "ZX"];
|
|
42
42
|
transformTool .centerDisplay = false;
|
|
43
43
|
transformTool .centerTool = false;
|
|
44
|
-
transformTool .xAxisDisplay = false;
|
|
45
|
-
transformTool .yAxisDisplay = false;
|
|
46
44
|
transformTool .zAxisDisplay = false;
|
|
47
45
|
transformTool .bboxColor = ToolColors .BLUE;
|
|
48
46
|
|
|
49
47
|
toolChildren .push (transformNode);
|
|
50
48
|
|
|
51
|
-
// Connections
|
|
49
|
+
// Connections outerRadius
|
|
52
50
|
|
|
53
|
-
this .node .
|
|
51
|
+
this .node ._outerRadius .addInterest ("set_outerRadius", this);
|
|
54
52
|
|
|
55
|
-
this .
|
|
53
|
+
this .set_outerRadius (this .node ._outerRadius);
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
// Transform Tool
|
|
56
|
+
// Transform Tool innerRadius
|
|
59
57
|
{
|
|
60
58
|
const
|
|
61
59
|
groupNode = this .getToolScene () .createNode ("Group"),
|
|
62
60
|
transformNode = this .getToolScene () .createNode ("Transform"),
|
|
63
61
|
transformTool = await transformNode .getValue () .addTool () .getToolInstance ();
|
|
64
62
|
|
|
65
|
-
this .#
|
|
63
|
+
this .#innerRadiusTransformNode = transformNode;
|
|
66
64
|
|
|
67
|
-
transformNode .scale .addInterest ("
|
|
65
|
+
transformNode .scale .addInterest ("set_innerRadiusScale", this);
|
|
68
66
|
transformTool .getField ("isActive") .addInterest ("handleUndo", this);
|
|
69
|
-
transformTool .getField ("isActive") .addInterest ("
|
|
67
|
+
transformTool .getField ("isActive") .addInterest ("set_innerRadiusActive", this);
|
|
70
68
|
|
|
71
69
|
groupNode .bboxSize = new X3D .Vector3 (2, 2, 0);
|
|
72
70
|
transformNode .children = [groupNode];
|
|
73
|
-
transformTool .group = `${this .getTypeName ()}.
|
|
71
|
+
transformTool .group = `${this .getTypeName ()}.innerRadius`;
|
|
74
72
|
transformTool .undo = false;
|
|
75
73
|
transformTool .tools = ["SCALE"];
|
|
76
74
|
transformTool .keys = [ ];
|
|
@@ -82,11 +80,11 @@ class Disk2DTool extends X3DGeometryNodeTool
|
|
|
82
80
|
|
|
83
81
|
toolChildren .push (transformNode);
|
|
84
82
|
|
|
85
|
-
// Connections
|
|
83
|
+
// Connections innerRadius
|
|
86
84
|
|
|
87
|
-
this .node .
|
|
85
|
+
this .node ._innerRadius .addInterest ("set_innerRadius", this);
|
|
88
86
|
|
|
89
|
-
this .
|
|
87
|
+
this .set_innerRadius (this .node ._innerRadius);
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
this .tool .undo = true;
|