<div dir="ltr">This is how I would do it. (BTW, the issue tracker of vtk.js would allow better formatting)<div><br></div><div>(function(){ // <==== Change</div><div><br></div><div><div>function vtkMyInteractorStyleImage(publicAPI, model) {</div><div> // Set our className</div><div> model.classHierarchy.push('vtkMyInteractorStyleImage');</div><div>}</div><div><br></div><div><br></div><div>const DEFAULT_VALUES = {</div><div> windowLevelStartPosition: [0, 0],</div><div> windowLevelCurrentPosition: [0, 0],</div><div> lastSlicePosition: 0,</div><div> windowLevelInitial: [1.0, 0.5],</div><div> currentImageProperty: 0,</div><div> currentImageNumber: -1,</div><div> interactionMode: 'IMAGE2D',</div><div> xViewRightVector: [0, 1, 0],</div><div> xViewUpVector: [0, 0, -1],</div><div> yViewRightVector: [1, 0, 0],</div><div> yViewUpVector: [0, 0, -1],</div><div> zViewRightVector: [1, 0, 0],</div><div> zViewUpVector: [0, 1, 0],</div><div>};</div><div><br></div><div>// ----------------------------------------------------------------------------</div><div><br></div><div>function extend(publicAPI, model, initialValues = {}) {</div><div> Object.assign(model, DEFAULT_VALUES, initialValues);</div><div><br></div><div> // Inheritance</div><div> vtk.Interaction.Style.vtkInteractorStyleImage.extend(publicAPI, model, initialValues); // <==== Change</div><div><br></div><div> // Create get-set macros</div><div> vtk.macro.setGet(publicAPI, model, ['interactionMode']); // <==== Change</div><div><br></div><div> // For more macro methods, see "Sources/macro.js"</div><div><br></div><div> // Object specific methods</div><div> vtkMyInteractorStyleImage(publicAPI, model);</div><div>}</div><div><br></div><div><br></div><div>// ----------------------------------------------------------------------------</div><div><br></div><div>const newInstance = vtk.macro.newInstance(extend, 'vtkMyInteractorStyleImage'); // <==== Change</div><div><br></div><div>// ----------------------------------------------------------------------------</div><div><br></div><div>const vtkMyInteractorStyleImage = Object.assign({ newInstance, extend }); // <==== Change</div></div><div><br></div><div>// Expose your class to the outside...</div><div>window.vtkMyInteractorStyleImage = vtkMyInteractorStyleImage; // <==== Change</div><div><br></div><div>})(); // <==== Change</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 6, 2018 at 2:29 PM Richard Frank via vtkusers <<a href="mailto:vtkusers@public.kitware.com">vtkusers@public.kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div class="m_2404216180854696987WordSection1"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I’m trying to subclass a vtk.js object in an script as here:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><a href="https://kitware.github.io/vtk-js/docs/intro_vtk_as_external_script.html" target="_blank">https://kitware.github.io/vtk-js/docs/intro_vtk_as_external_script.html</a><u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Here’s a codepen example of what I’m trying to do: subclass vtkInteractorStyleImage with vtkMyInteractorStyleImage<br>as a simple test.<u></u><u></u></p><p class="MsoNormal"><a href="https://codepen.io/RickFrank/pen/jpvqJe" target="_blank">https://codepen.io/RickFrank/pen/jpvqJe</a><u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I can’t seem to do this outside of a npm style project.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Is this a limitation of VTK.js?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thanks<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Rick Frank<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div>