Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var createSelect = require('gl-select-static')
var createFBO = require('gl-fbo')
var drawTriangle = require('a-big-triangle')
var mouseChange = require('mouse-change')
var mouseWheel = require('mouse-wheel')
var perspective = require('gl-mat4/perspective')
var ortho = require('gl-mat4/ortho')
var createShader = require('./lib/shader')
Expand Down Expand Up @@ -187,7 +186,21 @@ function createScene(options) {
cameraParams: cameraParams,
oncontextloss: null,
mouseListener: null,
_stopped: false
_stopped: false,

getAspectratio: function() {
return {
x: this.aspect[0],
y: this.aspect[1],
z: this.aspect[2]
}
},

setAspectratio: function(aspectratio) {
this.aspect[0] = aspectratio.x
this.aspect[1] = aspectratio.y
this.aspect[2] = aspectratio.z
}
}

var pickShape = [ (gl.drawingBufferWidth/scene.pixelRatio)|0, (gl.drawingBufferHeight/scene.pixelRatio)|0 ]
Expand Down Expand Up @@ -339,21 +352,6 @@ function createScene(options) {
objects = []
}

scene.wheelListener = mouseWheel(canvas, function(dx, dy) {
// TODO remove now that we can disable scroll via scrollZoom?
if(camera.keyBindingMode === false) return
if(!camera.enableWheel) return

if(camera._ortho) {
var s = (dx > dy) ? 1.1 : 1.0 / 1.1

scene.aspect[0] *= s
scene.aspect[1] *= s
scene.aspect[2] *= s
scene.redraw()
}
}, true)

//Update mouse position
scene._mouseRotating = false
scene._prevButtons = 0
Expand Down