new Scroll(app)
Scroll class.
Name | Type | Description |
---|---|---|
app | dwv. | The associated application. |
- Source
// create the dwv app
var app = new dwv.App();
// initialise
app.init({
dataViewConfigs: {'*': [{divId: 'layerGroup0'}]},
tools: {Scroll: {}}
});
// activate tool
app.addEventListener('load', function () {
app.setTool('Scroll');
});
// load dicom data
app.loadURLs([
'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm',
'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323707.dcm',
'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323563.dcm'
]);
Example with slider
// create the dwv app
var app = new dwv.App();
// initialise
app.init({
dataViewConfigs: {'*': [{divId: 'layerGroup0'}]},
tools: {Scroll: {}}
});
// create range
var range = document.createElement('input');
range.type = 'range';
range.min = 0;
range.id = 'sliceRange';
document.body.appendChild(range);
// update app on slider change
range.oninput = function () {
var lg = app.getLayerGroupByDivId('layerGroup0');
var vc = lg.getActiveViewLayer().getViewController();
var index = vc.getCurrentIndex();
var values = index.getValues();
values[2] = this.value;
vc.setCurrentIndex(new dwv.math.Index(values));
}
// activate tool and update range max on load
app.addEventListener('load', function () {
app.setTool('Scroll');
var size = app.getImage(0).getGeometry().getSize();
range.max = size.get(2) - 1;
});
// update slider on slice change (for ex via mouse wheel)
app.addEventListener('positionchange', function () {
var lg = app.getLayerGroupByDivId('layerGroup0');
var vc = lg.getActiveViewLayer().getViewController();
range.value = vc.getCurrentIndex().get(2);
});
// load dicom data
app.loadURLs([
'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm',
'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323707.dcm',
'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323563.dcm'
]);
Members
started :boolean
Interaction start flag.
- boolean
- Source
(inner) displayTooltip :boolean
Option to show or not a value tooltip on mousemove.
- boolean
- Source
(inner) scrollWhell :dwv.tool.ScrollWheel
Scroll wheel handler.
- Source
Methods
activate(_bool)
Activate the tool.
Name | Type | Description |
---|---|---|
_bool | boolean | The flag to activate or not. |
- Source
dblclick(event)
Handle double click.
Name | Type | Description |
---|---|---|
event | object | The key down event. |
- Source
init()
Initialise the tool.
- Source
keydown(event)
Handle key down event.
Name | Type | Description |
---|---|---|
event | object | The key down event. |
- Source
mousedown(event)
Handle mouse down event.
Name | Type | Description |
---|---|---|
event | object | The mouse down event. |
- Source
mousemove(event)
Handle mouse move event.
Name | Type | Description |
---|---|---|
event | object | The mouse move event. |
- Source
mouseout(event)
Handle mouse out event.
Name | Type | Description |
---|---|---|
event | object | The mouse out event. |
- Source
mouseup(_event)
Handle mouse up event.
Name | Type | Description |
---|---|---|
_event | object | The mouse up event. |
- Source
setFeatures(features)
Set the tool live features: disaply tooltip.
Name | Type | Description |
---|---|---|
features | object | The list of features. |
- Source
touchend(event)
Handle touch end event.
Name | Type | Description |
---|---|---|
event | object | The touch end event. |
- Source
touchmove(event)
Handle touch move event.
Name | Type | Description |
---|---|---|
event | object | The touch move event. |
- Source
touchstart(event)
Handle touch start event.
Name | Type | Description |
---|---|---|
event | object | The touch start event. |
- Source
wheel(event)
Handle mouse wheel event.
Name | Type | Description |
---|---|---|
event | object | The mouse wheel event. |
- Source
(inner) removeTooltipDiv()
Remove the tooltip html div.
- Source
(inner) showTooltip(event)
Displays a tooltip in a temparary span
. Works with css to hide/show the span only on mouse hover.
Name | Type | Description |
---|---|---|
event | object | The mouse move event. |
- Source