fix(viewer): cleans selection on scene disposal

This commit is contained in:
Dimitrie Stefanescu
2021-01-19 22:21:11 +00:00
parent 2326b5cc9e
commit 0269fec071
3 changed files with 16 additions and 11 deletions
+5 -3
View File
@@ -228,11 +228,12 @@ var v = new _modules_Viewer__WEBPACK_IMPORTED_MODULE_0__.default({
});
v.on('load-progress', args => console.log(args));
window.v = v;
var token = 'e844747dc6f6b0b5c7d5fbd82d66de6e9529531d75';
window.LoadData = /*#__PURE__*/function () {
var _LoadData = _asyncToGenerator(function* (url) {
url = url || document.getElementById('objectIdInput').value;
yield v.loadObject(url, 'e844747dc6f6b0b5c7d5fbd82d66de6e9529531d75');
url = url || document.getElementById('objectUrlInput').value;
yield v.loadObject(url, token);
});
function LoadData(_x) {
@@ -249,7 +250,7 @@ window.LoadDataOld = /*#__PURE__*/function () {
var loader = new _modules_ObjectLoader__WEBPACK_IMPORTED_MODULE_1__.default({
serverUrl: 'https://staging.speckle.dev',
streamId: '5486aa9fc7',
token: 'e844747dc6f6b0b5c7d5fbd82d66de6e9529531d75',
token,
objectId: id
});
var converter = new _modules_Converter__WEBPACK_IMPORTED_MODULE_2__.default(loader);
@@ -1113,6 +1114,7 @@ var SceneObjectManager = /*#__PURE__*/function () {
this.solidObjects.clear();
this.transparentObjects.clear();
this.viewer.selectionHelper.unselect();
this.objectIds = [];
this._postLoadFunction();
+10 -8
View File
@@ -28,21 +28,23 @@
<div class="row" style="padding-top: 20px">
<div class="twelve columns">
<h3>Viewer</h3>
<p>Click an object to select it. Double click it to focus on it. Here are some extra buttons:</p>
<h5>Controls summary:</h5>
<p>Click an object to select it. Double click it to focus on it. Press `esc` to clear the selection. Press `shift-s` to toggle a section plane. Press `s` while the section plane is active to toggle its control mode. Double click anywhere outside an object to zoom extents to the entire scene.</p>
</div>
<div class="twelve columns">
<button onclick="v.sceneManager.zoomExtents()">Zoom Extents</button>
<button onclick="v.postprocessing = !v.postprocessing">Postprocessing Toggle</button>
<!-- <button onclick="v.reflections = !v.reflections">Reflections Toggle</button> -->
<br>
<button onclick="v.sectionPlaneHelper.toggleSectionPlanes()">Show Section Plane</button>
press 's' to rotate/drag section plane
</div>
<div class="twelve columns">
<input id="objectIdInput" type="text" name="objectId" placeholder="Object Id" class=""/>
<button class="" onclick="LoadData()">Load Object</button>
<!-- </div>
<div class="twelve columns"> -->
<input id="objectUrlInput" type="text" name="objectId" placeholder="Object Url" style="width:49%" value="https://staging.speckle.dev/streams/a75ab4f10f/objects/a59617590b0bec4e9b5ee487ee75b1a7"/>
<button class="" onclick="LoadData()" style="width:49%">Load Object URL</button>
</div>
<div class="twelve columns">
<input id="objectIdInput" type="text" name="objectId" placeholder="Object Id" style="width:49%"/>
<button class="" onclick="LoadDataOld()" style="width:49%">Load Object URL</button>
</div>
<div class="twelve columns">
<button onclick="LoadDataOld('cd2d10cafb01a3e76954ae5906d00dfc')">Load Boat</button>
<button onclick="LoadDataOld('9a00ad76438d06612968190546552c56')">Load Jet Fuselage</button>
<button onclick="LoadDataOld('3242eb9db2199b83b7045507917689ae')">Load Strange Thing</button>
@@ -141,6 +141,7 @@ export default class SceneObjectManager {
}
this.solidObjects.clear()
this.transparentObjects.clear()
this.viewer.selectionHelper.unselect()
this.objectIds = []
this._postLoadFunction()