This switch focuses on simplifying the interactor observers, and forwarding events data to the callbacks:
- Remove
set/getAnimationState
andstart/stopState
in InteractorStyle. Instead, usestart/stop${stateName}
. - Remove
CharEvent
which was a duplicate ofKeyPressEvent
. - Rename
setEnable*(
tosetEnabled()
in AbstractWidget. - Remove
get2DPointerPosition()
from AbstractWidget: the position will now be properly positioned based on the canvas bounds as soon as it is caught by the Interactor. - Rename
Pinch
events toMouseWheel
events when those events are triggered by the mouse wheel, and use the wheel delta instead of a scale. - The interaction state is now passed through the callbacks to the events instead of being stored within the RenderWindowInteractor. That means the following API is replaced as such:
i.getEventPosition
->callData.position
(no need for an index)i.getScale
->callData.scale
if pinching, or usecallData.wheelDelta
if you are in a MouseWheel event insteadi.getTranslation
->callData.translation
i.getRotation
->callData.rotation
- for multitouch, touch positions are forwarded in
callData.positions
as{touchid1: {x:x1, y:y1, z:z1}, touchid2: {x:x2, y:y2, z:z2}
} - every "previous" state (
lastEventPosition
,lastScale
...) needs to be stored from the observer, for example initialized in ahandleStart${event}
callback and updated in thehandle${event}
callback - every callback data also holds
type
which is the event name
- Remove
findPokedRenderer
from the InteractorStyle/Observer. Instead, the latest poked renderer is passed through the callback ascallData.pokedRenderer
. That renderer is nevernull
within callbacks since the event won't forward if it is. You can also query the renderer throughRenderWindowInteractor.getCurrentRenderer()
but this is not recommended. - Add
renderer
as a parameter tocomputeWorldToDisplay
andcomputeDisplayToWorld
in InteractorObserver
Add more consistency in Readers
- Readers should have the following set of API
- setURL(url, options)
- fetchData(options) // OPTIONAL and should not be required
- parseAsArrayBuffer(ArrayBuffer) or parseAsText(String)
- Affected readers:
- STLReader
- Legacy/PolyDataReader
- ElevationReader
- MTLReader
- OBJReader
- PDBReader
- XMLReader
Refactor InteractorStyleManipulator with its manipulator
- Rename all the classes to make them consistent
- Update API to distinguish mode vs state (mode[drag/scroll], state[button,alt,control,shift])
- Update impacted code and example
Improve and normalize methods inside DataAccessHelper to allow network progress monitoring:
- Refactor fetchText(instance = {}, url, compression, progressCallback) into fetchText(instance = {}, url, options = { compression, progressCallback: fn() })
- Refactor fetchJSON(instance = {}, url, compression) into fetchJSON(instance = {}, baseURL, array, options = { compression, progressCallback: fn() })
- Refactor fetchArray(instance = {}, baseURL, array, fetchGzip = false) into fetchArray(instance = {}, baseURL, array, options = { compression: 'gz', progressCallback: fn() })
- Rename HttpDataSetReader.fetchZipFile(url) to HttpDataSetReader.fetchBinary(url, options)
The representation module as been removed and a better approach has been taken for OBJ/MTL loading.
Migrate to Webpack 2+ which changed the way rules are defined and how to intgrate vtk.js into your project. The following documentation has been updated accordingly.
vtkDataSetAttributes has been reimplemented to follow the VTK model. By doing so the data model structure as changed and any code that was using it as input will need to be updated.
Before:
{ "ArrayName": { vtkDataArray instance ... } }
After:
{ "activeTCoords": -1, "activeScalars": -1, "vtkClass": "vtkDataSetAttributes", "arrays": [ { "data": { vtkDataArray instance ... } } ], "activeNormals": -1, "activeGlobalIds": -1, "activeTensors": -1, "activePedigreeIds": -1, "activeVectors": -1 }
points used to be simple vtkDataArray. Now we have a vtkPoint class that contains a vtkDataArray in its data.
Before:
const coordsAsTypedArray = dataset.getPoints().getData();
After:
const dataArray = dataset.getPoints().getData(); const coordsAsTypedArray = dataArray.getData();
Serialization model changed from { type: 'vtkPolyData', ... } to { vtkClass: 'vtkPolyData', ... }.