|
@ -1888,6 +1888,19 @@ Graph3d.prototype._redrawDataGraph = function() { |
|
|
// End methods for drawing points per graph style.
|
|
|
// End methods for drawing points per graph style.
|
|
|
// -----------------------------------------------------------------------------
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Store startX, startY and startOffset for mouse operations |
|
|
|
|
|
* |
|
|
|
|
|
* @param {Event} event The event that occurred |
|
|
|
|
|
*/ |
|
|
|
|
|
Graph3d.prototype._storeMousePosition = function(event) { |
|
|
|
|
|
// get mouse position (different code for IE and all other browsers)
|
|
|
|
|
|
this.startMouseX = getMouseX(event); |
|
|
|
|
|
this.startMouseY = getMouseY(event); |
|
|
|
|
|
|
|
|
|
|
|
this._startCameraOffset = this.camera.getOffset(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Start a moving operation inside the provided parent element |
|
|
* Start a moving operation inside the provided parent element |
|
@ -1907,11 +1920,7 @@ Graph3d.prototype._onMouseDown = function(event) { |
|
|
this.leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); |
|
|
this.leftButtonDown = event.which ? (event.which === 1) : (event.button === 1); |
|
|
if (!this.leftButtonDown && !this.touchDown) return; |
|
|
if (!this.leftButtonDown && !this.touchDown) return; |
|
|
|
|
|
|
|
|
// get mouse position (different code for IE and all other browsers)
|
|
|
|
|
|
this.startMouseX = getMouseX(event); |
|
|
|
|
|
this.startMouseY = getMouseY(event); |
|
|
|
|
|
|
|
|
|
|
|
this._startCameraOffset = this.camera.getOffset(); |
|
|
|
|
|
|
|
|
this._storeMousePosition(event); |
|
|
|
|
|
|
|
|
this.startStart = new Date(this.start); |
|
|
this.startStart = new Date(this.start); |
|
|
this.startEnd = new Date(this.end); |
|
|
this.startEnd = new Date(this.end); |
|
@ -1938,36 +1947,25 @@ Graph3d.prototype._onMouseDown = function(event) { |
|
|
*/ |
|
|
*/ |
|
|
Graph3d.prototype._onMouseMove = function (event) { |
|
|
Graph3d.prototype._onMouseMove = function (event) { |
|
|
event = event || window.event; |
|
|
event = event || window.event; |
|
|
|
|
|
|
|
|
|
|
|
// calculate change in mouse position
|
|
|
|
|
|
var diffX = parseFloat(getMouseX(event)) - this.startMouseX; |
|
|
|
|
|
var diffY = parseFloat(getMouseY(event)) - this.startMouseY; |
|
|
|
|
|
|
|
|
// move with ctrl or rotate by other
|
|
|
|
|
|
|
|
|
// move with ctrl or rotate by other
|
|
|
if (event && event.ctrlKey === true) { |
|
|
if (event && event.ctrlKey === true) { |
|
|
// calculate change in mouse position
|
|
|
// calculate change in mouse position
|
|
|
var camera = this.camera, |
|
|
|
|
|
offset = camera.getOffset(); |
|
|
|
|
|
|
|
|
|
|
|
var diffX = parseFloat(getMouseX(event)) - this.startMouseX; |
|
|
|
|
|
var diffY = parseFloat(getMouseY(event)) - this.startMouseY; |
|
|
|
|
|
|
|
|
|
|
|
var scaleX = this.frame.clientWidth * 0.5; |
|
|
|
|
|
var scaleY = this.frame.clientHeight * 0.5; |
|
|
|
|
|
|
|
|
var scaleX = this.frame.clientWidth * 0.5; |
|
|
|
|
|
var scaleY = this.frame.clientHeight * 0.5; |
|
|
|
|
|
|
|
|
var offXNew = (this._startCameraOffset.x || 0) - ((diffX / scaleX) * this.camera.armLength) * 0.8; |
|
|
var offXNew = (this._startCameraOffset.x || 0) - ((diffX / scaleX) * this.camera.armLength) * 0.8; |
|
|
var offYNew = (this._startCameraOffset.y || 0) + ((diffY / scaleY) * this.camera.armLength) * 0.8; |
|
|
var offYNew = (this._startCameraOffset.y || 0) + ((diffY / scaleY) * this.camera.armLength) * 0.8; |
|
|
|
|
|
|
|
|
this.camera.setOffset(offXNew, offYNew); |
|
|
this.camera.setOffset(offXNew, offYNew); |
|
|
|
|
|
|
|
|
// меняем startX, startY и startOffset
|
|
|
|
|
|
this._startCameraOffset = this.camera.getOffset(); |
|
|
|
|
|
this.startMouseX = getMouseX(event); |
|
|
|
|
|
this.startMouseY = getMouseY(event); |
|
|
|
|
|
|
|
|
this._storeMousePosition(event); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
|
|
|
// calculate change in mouse position
|
|
|
|
|
|
var diffX = parseFloat(getMouseX(event)) - this.startMouseX; |
|
|
|
|
|
var diffY = parseFloat(getMouseY(event)) - this.startMouseY; |
|
|
|
|
|
|
|
|
|
|
|
var horizontalNew = this.startArmRotation.horizontal + diffX / 200; |
|
|
var horizontalNew = this.startArmRotation.horizontal + diffX / 200; |
|
|
var verticalNew = this.startArmRotation.vertical + diffY / 200; |
|
|
|
|
|
|
|
|
var verticalNew = this.startArmRotation.vertical + diffY / 200; |
|
|
|
|
|
|
|
|
var snapAngle = 4; // degrees
|
|
|
var snapAngle = 4; // degrees
|
|
|
var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI); |
|
|
var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI); |
|
|