Skip to content

Commit c0067af

Browse files
authored
fix: 🐛 Move to orthographic projection for View2D (#61)
1 parent 0f9a6a3 commit c0067af

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

examples/VTKCrosshairsExample.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,21 @@ class VTKCrosshairsExample extends Component {
7777
return (
7878
<>
7979
<div className="row">
80-
<div className="col-xs-12">
80+
<div className="col-xs-6">
8181
<p>
8282
This example demonstrates how to use the Crosshairs manipulator.
8383
</p>
8484
</div>
8585
</div>
8686
<div className="row">
87-
<div className="col-xs-12 col-sm-6">
87+
<div className="col-xs-6 col-xs-6">
8888
<View2D
8989
volumes={this.state.volumes}
9090
onCreated={this.storeApi(2)}
9191
orientation={{ sliceNormal: [0, 1, 0], viewUp: [0, 0, 1] }}
9292
/>
9393
</div>
94-
<div className="col-xs-12 col-sm-6">
94+
<div className="col-xs-6 col-xs-6">
9595
<View2D
9696
volumes={this.state.volumes}
9797
onCreated={this.storeApi(1)}
@@ -101,7 +101,7 @@ class VTKCrosshairsExample extends Component {
101101
</div>
102102

103103
<div className="row">
104-
<div className="col-xs-12 col-sm-6">
104+
<div className="col-xs-6 col-xs-6">
105105
<View2D
106106
volumes={this.state.volumes}
107107
onCreated={this.storeApi(0)}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"peerDependencies": {
2424
"react": "^16.8.6",
2525
"react-dom": "^16.8.6",
26-
"vtk.js": "^11.6.0"
26+
"vtk.js": "^11.7.1"
2727
},
2828
"dependencies": {
2929
"date-fns": "^2.2.1",
@@ -81,7 +81,7 @@
8181
"style-loader": "^0.23.1",
8282
"stylelint": "^10.1.0",
8383
"stylelint-config-recommended": "^2.2.0",
84-
"vtk.js": "^11.6.0",
84+
"vtk.js": "^11.7.1",
8585
"webpack": "4.34.0",
8686
"webpack-cli": "^3.3.4",
8787
"webpack-dev-server": "^3.8.0",

src/VTKViewport/View2D.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ export default class View2D extends Component {
186186
istyle.setSliceNormal(0, 0, 1);
187187
}
188188

189+
const camera = this.renderer.getActiveCamera();
190+
191+
camera.setParallelProjection(true);
192+
this.renderer.resetCamera();
193+
189194
istyle.setVolumeMapper(istyleVolumeMapper);
190195
const range = istyle.getSliceRange();
191196
istyle.setSlice((range[0] + range[1]) / 2);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13602,10 +13602,10 @@ vm-browserify@^1.0.1:
1360213602
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019"
1360313603
integrity sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw==
1360413604

13605-
vtk.js@^11.6.0:
13606-
version "11.6.0"
13607-
resolved "https://registry.yarnpkg.com/vtk.js/-/vtk.js-11.6.0.tgz#a30f95cfb138453890bd85f5bca88c53ed7c2775"
13608-
integrity sha512-emkpLZVsuaSPLrVsbaosdD5RQQmal4PPfVotDIWb58aBbswXYt4pliaY3EDFNW3nTsKPs9ttadM4f4n8fVWVbQ==
13605+
vtk.js@^11.7.1:
13606+
version "11.7.1"
13607+
resolved "https://registry.yarnpkg.com/vtk.js/-/vtk.js-11.7.1.tgz#e9527c75d84e292c5d25fc4cacf62d42c777930e"
13608+
integrity sha512-r6KTDYRF+XBq8gvoi27HJs+1DN4E39FX1k9i15el6JXRuZQebnBjWZ0W8XlfM8Nc6AAAax6DdauBFZdhyG0s/Q==
1360913609
dependencies:
1361013610
blueimp-md5 "2.10.0"
1361113611
commander "2.11.0"

0 commit comments

Comments
 (0)