Mercurial > hg > orthanc-stl
diff Sources/OrthancExplorer.js @ 39:b6910092bcca
added button to open O3DV
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 05 Apr 2024 08:25:17 +0200 |
parents | 13698d34e059 |
children | 967f947014ac |
line wrap: on
line diff
--- a/Sources/OrthancExplorer.js Fri Apr 05 08:19:54 2024 +0200 +++ b/Sources/OrthancExplorer.js Fri Apr 05 08:25:17 2024 +0200 @@ -25,6 +25,22 @@ const STL_PLUGIN_SOP_CLASS_UID_STL = '1.2.840.10008.5.1.4.1.1.104.3'; const STL_PLUGIN_SOP_CLASS_UID_RT_STRUCT = '1.2.840.10008.5.1.4.1.1.481.3'; + +function AddStlViewer(target, name, callback) { + var li = $('<li>', { + name: name, + }).click(callback); + + li.append($('<a>', { + href: '#', + rel: 'close', + text: name + })); + + target.append(li); +} + + function AddOpenStlViewerButton(instanceId, id, parent) { var b = $('<a>') .attr('id', id) @@ -36,10 +52,30 @@ .button(); b.insertAfter($('#' + parent)); + b.click(function() { - if ($.mobile.pageData) { + var viewers = $('<ul>') + .attr('data-divider-theme', 'd') + .attr('data-role', 'listview'); + + AddStlViewer(viewers, 'Basic viewer built using Three.js', function() { window.open('../stl/app/three.html?instance=' + instanceId); - } + }); + + AddStlViewer(viewers, 'Online3DViewer', function() { + window.open('../stl/app/o3dv.html?instance=' + instanceId); + }); + + // Launch the dialog + $('#dialog').simpledialog2({ + mode: 'blank', + animate: false, + headerText: 'Choose STL viewer', + headerClose: true, + forceInput: false, + width: '100%', + blankContent: viewers + }); }); }