kopia lustrzana https://github.com/robhawkes/vizicities
Updated zoom logic
rodzic
c51097022f
commit
e603f69717
|
@ -58,12 +58,28 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
VIZI.Camera.prototype.zoom = function(delta) {
|
VIZI.Camera.prototype.zoom = function(delta) {
|
||||||
|
var oldcameraRadius = this.cameraRadius;
|
||||||
|
|
||||||
this.cameraRadius += delta;
|
this.cameraRadius += delta;
|
||||||
|
|
||||||
|
var cameraRadiusDiff = this.cameraRadius - oldcameraRadius;
|
||||||
|
|
||||||
// Cap zoom to bounds
|
// Cap zoom to bounds
|
||||||
this.cameraRadius = Math.max(Math.min(this.cameraRadius, 5000), 1000);
|
if (this.cameraRadius < 1000) {
|
||||||
|
this.cameraRadius = 1000;
|
||||||
|
cameraRadiusDiff = 1000 - oldcameraRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.cameraRadius > 5000) {
|
||||||
|
this.cameraRadius = 5000;
|
||||||
|
cameraRadiusDiff = 5000 - oldcameraRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.camera.translateZ( cameraRadiusDiff );
|
||||||
|
|
||||||
this.updatePosition();
|
this.updatePosition();
|
||||||
|
|
||||||
|
this.publish("render");
|
||||||
};
|
};
|
||||||
|
|
||||||
VIZI.Camera.prototype.pan = function(delta3d) {
|
VIZI.Camera.prototype.pan = function(delta3d) {
|
||||||
|
|
Ładowanie…
Reference in New Issue