Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ControlsMode.prototype.controls = function() {
- var a, j, len, numSel, ref, ref1, thing, z;
- if (!commander) {
- return;
- }
- this.keyScroll[0] *= .8;
- this.keyScroll[1] *= .8;
- a = 10 * this.zoom * settings.speedValue("Scroll Speed");
- this.keyScroll[1] += (this.panUp + this.panDown) * a;
- this.keyScroll[0] += (this.panLeft + this.panRight) * a;
- v2.add(this.focus, this.keyScroll);
- if (v2.mag(this.focus) > this.mapBounds) {
- this.focus[0] -= this.focus[0] * .003;
- this.focus[1] -= this.focus[1] * .003;
- }
- this.keyZoom *= .9;
- z = .02;
- this.keyZoom += (this.zoomIn + this.zoomOut) * z * settings.speedValue("Scroll Speed");
- this.zoom += this.keyZoom;
- if (this.zoom < 0.5) {
- this.zoom = 0.5;
- }
- if (this.zoom > 10) {
- this.zoom = 10;
- }
- numSel = (ref = commander.selection) != null ? ref.length : void 0;
- if (this.centerOnUnit && numSel > 0) {
- this.focus[0] = 0;
- this.focus[1] = 0;
- ref1 = commander.selection;
- for (j = 0, len = ref1.length; j < len; j++) {
- thing = ref1[j];
- this.focus[0] -= thing.pos[0] / numSel;
- this.focus[1] -= thing.pos[1] / numSel;
- }
- }
- };
RAW Paste Data