Skip to content

Commit

Permalink
Merge pull request #514 from floryst/fix_orientation_marker_regression
Browse files Browse the repository at this point in the history
fix(OrientationMarkerWidget): Regression in widget corner specification
  • Loading branch information
floryst authored Jan 19, 2018
2 parents 74d161c + 1e5e877 commit ccf74ac
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Sources/Interaction/Widgets/OrientationMarkerWidget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import vtkRenderer from 'vtk.js/Sources/Rendering/Core/Renderer';
import Constants from 'vtk.js/Sources/Interaction/Widgets/OrientationMarkerWidget/Constants';

const { vtkErrorMacro } = macro;
const { Corners } = Constants;

// ----------------------------------------------------------------------------
// vtkOrientationMarkerWidget
Expand Down Expand Up @@ -32,7 +33,19 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
const xFrac = pixelSize / viewXSize;
const yFrac = pixelSize / viewYSize;
// [left bottom right top]
return [0, 1 - yFrac, xFrac, 1];
switch (model.viewportCorner) {
case Corners.TOP_LEFT:
return [0, 1 - yFrac, xFrac, 1];
case Corners.TOP_RIGHT:
return [1 - xFrac, 1 - yFrac, 1, 1];
case Corners.BOTTOM_LEFT:
return [0, 0, xFrac, yFrac];
case Corners.BOTTOM_RIGHT:
return [1 - xFrac, 0, 1, yFrac];
default:
vtkErrorMacro('Invalid widget corner');
return null;
}
};

publicAPI.updateViewport = () => {
Expand Down

0 comments on commit ccf74ac

Please sign in to comment.