(element, options)
| 18103 | var hasPassive = __webpack_require__(7520) |
| 18104 | |
| 18105 | function createCamera(element, options) { |
| 18106 | element = element || document.body |
| 18107 | options = options || {} |
| 18108 | |
| 18109 | var limits = [ 0.01, Infinity ] |
| 18110 | if('distanceLimits' in options) { |
| 18111 | limits[0] = options.distanceLimits[0] |
| 18112 | limits[1] = options.distanceLimits[1] |
| 18113 | } |
| 18114 | if('zoomMin' in options) { |
| 18115 | limits[0] = options.zoomMin |
| 18116 | } |
| 18117 | if('zoomMax' in options) { |
| 18118 | limits[1] = options.zoomMax |
| 18119 | } |
| 18120 | |
| 18121 | var view = createView({ |
| 18122 | center: options.center || [0,0,0], |
| 18123 | up: options.up || [0,1,0], |
| 18124 | eye: options.eye || [0,0,10], |
| 18125 | mode: options.mode || 'orbit', |
| 18126 | distanceLimits: limits |
| 18127 | }) |
| 18128 | |
| 18129 | var pmatrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] |
| 18130 | var distance = 0.0 |
| 18131 | var width = element.clientWidth |
| 18132 | var height = element.clientHeight |
| 18133 | |
| 18134 | var camera = { |
| 18135 | keyBindingMode: 'rotate', |
| 18136 | enableWheel: true, |
| 18137 | view: view, |
| 18138 | element: element, |
| 18139 | delay: options.delay || 16, |
| 18140 | rotateSpeed: options.rotateSpeed || 1, |
| 18141 | zoomSpeed: options.zoomSpeed || 1, |
| 18142 | translateSpeed: options.translateSpeed || 1, |
| 18143 | flipX: !!options.flipX, |
| 18144 | flipY: !!options.flipY, |
| 18145 | modes: view.modes, |
| 18146 | _ortho: options._ortho || (options.projection && options.projection.type === 'orthographic') || false, |
| 18147 | tick: function() { |
| 18148 | var t = now() |
| 18149 | var delay = this.delay |
| 18150 | var ctime = t - 2 * delay |
| 18151 | view.idle(t-delay) |
| 18152 | view.recalcMatrix(ctime) |
| 18153 | view.flush(t-(100+delay*2)) |
| 18154 | var allEqual = true |
| 18155 | var matrix = view.computedMatrix |
| 18156 | for(var i=0; i<16; ++i) { |
| 18157 | allEqual = allEqual && (pmatrix[i] === matrix[i]) |
| 18158 | pmatrix[i] = matrix[i] |
| 18159 | } |
| 18160 | var sizeChanged = |
| 18161 | element.clientWidth === width && |
| 18162 | element.clientHeight === height |
no test coverage detected
searching dependent graphs…