@niivue/niivue 0.29.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/niivue.es.js +31 -12
- package/dist/niivue.umd.js +3 -3
- package/package.json +1 -1
- package/src/index.html +1 -1
- package/src/nvimage.js +13 -2
package/dist/niivue.es.js
CHANGED
|
@@ -100009,7 +100009,7 @@ function requireSeries() {
|
|
|
100009
100009
|
var daikon2 = daikon2 || {};
|
|
100010
100010
|
daikon2.CompressionUtils = daikon2.CompressionUtils || (typeof commonjsRequire !== "undefined" ? requireCompressionUtils() : null);
|
|
100011
100011
|
daikon2.Dictionary = daikon2.Dictionary || (typeof commonjsRequire !== "undefined" ? requireDictionary() : null);
|
|
100012
|
-
daikon2.Image = daikon2.Image || (typeof commonjsRequire !== "undefined" ? requireImage() : null);
|
|
100012
|
+
daikon2.Image = daikon2.Image || (typeof commonjsRequire !== "undefined" ? requireImage().default : null);
|
|
100013
100013
|
daikon2.OrderedMapIterator = daikon2.OrderedMapIterator || (typeof commonjsRequire !== "undefined" ? requireIterator() : null);
|
|
100014
100014
|
daikon2.OrderedMap = daikon2.OrderedMap || (typeof commonjsRequire !== "undefined" ? requireOrderedmap() : null);
|
|
100015
100015
|
daikon2.Parser = daikon2.Parser || (typeof commonjsRequire !== "undefined" ? requireParser() : null);
|
|
@@ -106869,8 +106869,18 @@ NVImage.loadFromUrl = async function({
|
|
|
106869
106869
|
urlImgData = url.substring(0, url.lastIndexOf("HEAD")) + "BRIK";
|
|
106870
106870
|
}
|
|
106871
106871
|
}
|
|
106872
|
-
let urlParts
|
|
106872
|
+
let urlParts;
|
|
106873
|
+
try {
|
|
106874
|
+
urlParts = new URL(url).pathname.split("/");
|
|
106875
|
+
} catch (e) {
|
|
106876
|
+
urlParts = url.split("/");
|
|
106877
|
+
}
|
|
106878
|
+
console.log(url, name, urlParts);
|
|
106873
106879
|
name = urlParts.slice(-1)[0];
|
|
106880
|
+
if (name.indexOf("?") > -1) {
|
|
106881
|
+
name = name.slice(0, name.indexOf("?"));
|
|
106882
|
+
}
|
|
106883
|
+
console.log(name);
|
|
106874
106884
|
let dataBuffer = await response.arrayBuffer();
|
|
106875
106885
|
let pairedImgData = null;
|
|
106876
106886
|
if (urlImgData.length > 0) {
|
|
@@ -112052,8 +112062,15 @@ const MESH_EXTENSIONS = [
|
|
|
112052
112062
|
"VTK",
|
|
112053
112063
|
"X3D"
|
|
112054
112064
|
];
|
|
112065
|
+
const dragModes = Object.freeze({
|
|
112066
|
+
none: 0,
|
|
112067
|
+
contrast: 1,
|
|
112068
|
+
measurement: 2,
|
|
112069
|
+
pan: 3
|
|
112070
|
+
});
|
|
112055
112071
|
function Niivue(options = {}) {
|
|
112056
112072
|
this.opts = {};
|
|
112073
|
+
this.dragModes = dragModes;
|
|
112057
112074
|
this.defaults = {
|
|
112058
112075
|
textHeight: 0.06,
|
|
112059
112076
|
colorbarHeight: 0.05,
|
|
@@ -112080,8 +112097,7 @@ function Niivue(options = {}) {
|
|
|
112080
112097
|
multiplanarPadPixels: 0,
|
|
112081
112098
|
isRadiologicalConvention: false,
|
|
112082
112099
|
meshThicknessOn2D: Infinity,
|
|
112083
|
-
|
|
112084
|
-
isDragForPanZoom: false,
|
|
112100
|
+
dragMode: dragModes.contrast,
|
|
112085
112101
|
isDepthPickMesh: false,
|
|
112086
112102
|
isCornerOrientationText: false,
|
|
112087
112103
|
sagittalNoseLeft: false,
|
|
@@ -112533,6 +112549,8 @@ Niivue.prototype.mouseLeftButtonHandler = function(e) {
|
|
|
112533
112549
|
};
|
|
112534
112550
|
Niivue.prototype.mouseRightButtonHandler = function(e) {
|
|
112535
112551
|
let pos = this.getNoPaddingNoBorderCanvasRelativeMousePosition(e, this.gl.canvas);
|
|
112552
|
+
if (this.opts.dragMode === dragModes.none)
|
|
112553
|
+
return;
|
|
112536
112554
|
this.setDragStart(pos.x, pos.y);
|
|
112537
112555
|
if (!this.isDragging)
|
|
112538
112556
|
this.scene.pan2DxyzmmAtMouseDown = this.scene.pan2Dxyzmm.slice();
|
|
@@ -112619,9 +112637,9 @@ Niivue.prototype.mouseUpListener = function() {
|
|
|
112619
112637
|
this.drawPenAxCorSag = -1;
|
|
112620
112638
|
if (this.isDragging) {
|
|
112621
112639
|
this.isDragging = false;
|
|
112622
|
-
if (this.opts.
|
|
112623
|
-
|
|
112624
|
-
if (this.opts.
|
|
112640
|
+
if (this.opts.dragMode === dragModes.contrast)
|
|
112641
|
+
console.log("Poko");
|
|
112642
|
+
if (this.opts.dragMode !== dragModes.contrast)
|
|
112625
112643
|
return;
|
|
112626
112644
|
this.calculateNewRange();
|
|
112627
112645
|
this.refreshLayers(this.volumes[0], 0, this.volumes.length);
|
|
@@ -112675,7 +112693,7 @@ Niivue.prototype.touchEndListener = function(e) {
|
|
|
112675
112693
|
}
|
|
112676
112694
|
if (this.isDragging) {
|
|
112677
112695
|
this.isDragging = false;
|
|
112678
|
-
if (this.opts.
|
|
112696
|
+
if (this.opts.dragMode !== dragModes.contrast)
|
|
112679
112697
|
return;
|
|
112680
112698
|
this.calculateNewRange();
|
|
112681
112699
|
this.refreshLayers(this.volumes[0], 0, this.volumes.length);
|
|
@@ -113591,7 +113609,7 @@ Niivue.prototype.setSelectionBoxColor = function(color) {
|
|
|
113591
113609
|
this.opts.selectionBoxColor = color;
|
|
113592
113610
|
};
|
|
113593
113611
|
Niivue.prototype.sliceScroll2D = function(posChange, x2, y, isDelta = true) {
|
|
113594
|
-
if (posChange !== 0 && this.opts.
|
|
113612
|
+
if (posChange !== 0 && this.opts.dragMode === dragModes.pan) {
|
|
113595
113613
|
let zoom = this.scene.pan2Dxyzmm[3] * (1 + 10 * posChange);
|
|
113596
113614
|
zoom = Math.round(zoom * 10) / 10;
|
|
113597
113615
|
this.scene.pan2Dxyzmm[3] = zoom;
|
|
@@ -117020,7 +117038,7 @@ Niivue.prototype.drawScene = function() {
|
|
|
117020
117038
|
if (this.opts.isColorbar)
|
|
117021
117039
|
this.drawColorbar();
|
|
117022
117040
|
if (this.isDragging) {
|
|
117023
|
-
if (this.opts.
|
|
117041
|
+
if (this.opts.dragMode === dragModes.pan) {
|
|
117024
117042
|
this.dragForPanZoom([
|
|
117025
117043
|
this.dragStart[0],
|
|
117026
117044
|
this.dragStart[1],
|
|
@@ -117029,7 +117047,7 @@ Niivue.prototype.drawScene = function() {
|
|
|
117029
117047
|
]);
|
|
117030
117048
|
return;
|
|
117031
117049
|
}
|
|
117032
|
-
if (this.opts.
|
|
117050
|
+
if (this.opts.dragMode === dragModes.measurement) {
|
|
117033
117051
|
this.drawMeasurementTool([
|
|
117034
117052
|
this.dragStart[0],
|
|
117035
117053
|
this.dragStart[1],
|
|
@@ -117038,6 +117056,7 @@ Niivue.prototype.drawScene = function() {
|
|
|
117038
117056
|
]);
|
|
117039
117057
|
return;
|
|
117040
117058
|
}
|
|
117059
|
+
console.log(this.opts.dragMode === dragModes.measurement, ">>", this.opts.dragMode, dragModes.measurement);
|
|
117041
117060
|
if (this.inRenderTile(this.dragStart[0], this.dragStart[1]) >= 0)
|
|
117042
117061
|
return;
|
|
117043
117062
|
let width = Math.abs(this.dragStart[0] - this.dragEnd[0]);
|
|
@@ -117060,4 +117079,4 @@ Niivue.prototype.drawScene = function() {
|
|
|
117060
117079
|
this.readyForSync = true;
|
|
117061
117080
|
return posString;
|
|
117062
117081
|
};
|
|
117063
|
-
export { NVImage, NVImageFromUrlOptions, NVMesh, NVMeshFromUrlOptions, Niivue, colortables };
|
|
117082
|
+
export { NVImage, NVImageFromUrlOptions, NVMesh, NVMeshFromUrlOptions, Niivue, colortables, dragModes };
|