Skip to content

Commit

Permalink
Don't override OrbitControls for Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
petervanderwalt committed Aug 14, 2018
1 parent 95ee90b commit bf7eeb8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ <h6>Calculating Toolpaths...</h6>
<div oncontextmenu="return false;" id="viewerContext"></div> -->
<!-- avoiding popup when right mouse is clicked -->

<div class="dialog" data-overlay-click-close="true" data-role="dialog" id="statusmodal" data-to-top="true" data-to-top="true">
<div class="dialog" data-overlay-click-close="true" data-role="dialog" id="statusmodal" data-to-top="true">
<div class="dialog-title" id="statusTitle">Status title </div>
<div class="dialog-content">
<div id="statusBody"></div>
Expand Down
16 changes: 13 additions & 3 deletions js/advanced-cam-viewer-mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ function mouseSelectMode() {
if (dragcontrols) {
dragcontrols.dispose();
}
if (controls.enableRotate) {
helpoverlay.innerHTML = "<kbd>Left Mouse</kbd> = Select / <kbd>Middle Mouse</kbd> = Orbit / <kbd>Right Mouse</kbd> = Pan / <kbd>Wheel</kbd> = Zoom / <kbd>Ctrl</kbd> = Multiple Select / <kbd>Del</kbd> = Delete Selected"
var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
if (!isMac) {
if (controls.enableRotate) {
helpoverlay.innerHTML = "<kbd>Left Mouse</kbd> = Select / <kbd>Middle Mouse</kbd> = Orbit / <kbd>Right Mouse</kbd> = Pan / <kbd>Wheel</kbd> = Zoom / <kbd>Ctrl</kbd> = Multiple Select / <kbd>Del</kbd> = Delete Selected"
} else {
helpoverlay.innerHTML = "<kbd>Left Mouse</kbd> = Select / <kbd>Right Mouse</kbd> = Pan / <kbd>Wheel</kbd> = Zoom / <kbd>Ctrl</kbd> = Multiple Select / <kbd>Del</kbd> = Delete Selected"
}
} else {
helpoverlay.innerHTML = "<kbd>Left Mouse</kbd> = Select / <kbd>Right Mouse</kbd> = Pan / <kbd>Wheel</kbd> = Zoom / <kbd>Ctrl</kbd> = Multiple Select / <kbd>Del</kbd> = Delete Selected"
if (controls.enableRotate) {
helpoverlay.innerHTML = "<kbd>Left Mouse</kbd> = Select / <kbd>Middle Mouse</kbd> = Orbit / <kbd>Right Mouse</kbd> = Pan / <kbd>Wheel</kbd> = Zoom / <kbd>Ctrl</kbd> = Multiple Select / <kbd>Del</kbd> = Delete Selected"
} else {
helpoverlay.innerHTML = "<kbd>Ctrl</kbd> = Multiple Select / <kbd>Del</kbd> = Delete Selected"
}
}

};

// move mode
Expand Down
14 changes: 9 additions & 5 deletions js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,15 @@ function init3D() {

controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.target.set(0, 0, 0); // view direction perpendicular to XY-plane
controls.mouseButtons = {
ORBIT: THREE.MOUSE.MIDDLE,
ZOOM: false,
PAN: THREE.MOUSE.RIGHT
};
var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
if (!isMac) {
controls.mouseButtons = {
ORBIT: THREE.MOUSE.MIDDLE,
ZOOM: false,
PAN: THREE.MOUSE.RIGHT
};
}


controls.enableRotate = true;
controls.enableZoom = true; // optional
Expand Down

0 comments on commit bf7eeb8

Please sign in to comment.