viewport cleaned
This commit is contained in:
1 parent
45a86d05cd
commit
8c7cdce253
3 files changed
+38
-24
No files matched your search
@@ -56,6 +56,9 @@ function newEdgeEditor () {
|
||||
width: 0,
|
||||
height: 0
|
||||
}
|
||||
|
||||
let doubleClickCounter = 0
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
@@ -101,7 +104,26 @@ function newEdgeEditor () {
|
||||
thisObject.isMouseOver = false
|
||||
}
|
||||
|
||||
function onDoubleClick () {
|
||||
doubleClickCounter = 0
|
||||
|
||||
// canvas.chartingSpace.viewport.displaceToContainer(thisObject.container.parentContainer)
|
||||
|
||||
if (canvas.chartingSpace.viewport.zoomLevel === DOUBLE_CLICK_ZOOM_IN_LEVEL) {
|
||||
canvas.chartingSpace.viewport.zoomAtCenter(DOUBLE_CLICK_ZOOM_OUT_LEVEL)
|
||||
} else {
|
||||
canvas.chartingSpace.viewport.zoomAtCenter(DOUBLE_CLICK_ZOOM_IN_LEVEL)
|
||||
}
|
||||
}
|
||||
|
||||
function onDragStarted (event) {
|
||||
if (doubleClickCounter > 0) {
|
||||
onDoubleClick()
|
||||
return
|
||||
} else {
|
||||
doubleClickCounter = 50
|
||||
}
|
||||
|
||||
mouseWhenDragStarted = {
|
||||
position: {
|
||||
x: event.x,
|
||||
@@ -204,6 +226,18 @@ function newEdgeEditor () {
|
||||
}
|
||||
|
||||
function physics () {
|
||||
draggingPhysics()
|
||||
doubleClickPhysics()
|
||||
}
|
||||
|
||||
function doubleClickPhysics () {
|
||||
doubleClickCounter--
|
||||
if (doubleClickCounter < 0) {
|
||||
doubleClickCounter = 0
|
||||
}
|
||||
}
|
||||
|
||||
function draggingPhysics () {
|
||||
if (thisObject.container.frame.position.x === 0 && thisObject.container.frame.position.y === 0) { return }
|
||||
|
||||
let mouseNoZoom = canvas.chartingSpace.viewport.unTransformThisPoint(mouse.position)
|
||||
|
||||
@@ -50,14 +50,7 @@ function newViewport () {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
let targetPosition = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
let positionIncrement = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
|
||||
thisObject.mousePosition = {
|
||||
x: 0,
|
||||
y: 0
|
||||
@@ -169,14 +162,6 @@ function newViewport () {
|
||||
thisObject.zoomLevel = thisObject.zoomLevel - ANIMATION_INCREMENT
|
||||
changeZoom(thisObject.zoomLevel + ANIMATION_INCREMENT, thisObject.zoomLevel)
|
||||
}
|
||||
|
||||
if (positionIncrement.y !== 0) {
|
||||
if (Math.trunc(Math.abs(targetPosition.y - position.y) * 1000) >= Math.trunc(Math.abs(positionIncrement.y) * 1000)) {
|
||||
position.y = position.y + positionIncrement.y
|
||||
} else {
|
||||
positionIncrement.y = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseWheel (event) {
|
||||
@@ -290,14 +275,6 @@ function newViewport () {
|
||||
|
||||
saveObjectState()
|
||||
|
||||
targetPosition.x = position.x
|
||||
targetPosition.y = position.y
|
||||
|
||||
positionIncrement = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
|
||||
thisObject.eventHandler.raiseEvent('Zoom Changed')
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,9 @@ const _3_MINUTES_IN_MILISECONDS = 3 * 60 * 1000;
|
||||
const _2_MINUTES_IN_MILISECONDS = 2 * 60 * 1000;
|
||||
const _1_MINUTE_IN_MILISECONDS = 1 * 60 * 1000;
|
||||
|
||||
const DOUBLE_CLICK_ZOOM_OUT_LEVEL = 0
|
||||
const DOUBLE_CLICK_ZOOM_IN_LEVEL = 2
|
||||
|
||||
let NEW_SESSION_INITIAL_DATE = new Date(); // This value will be overwritten at the canvas.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
|
||||
let INITIAL_ZOOM_LEVEL = -28.25 // This is the zoom level at the view port in which the APP starts.
|
||||
let INITIAL_TIME_PERIOD = ONE_DAY_IN_MILISECONDS // This value will be overwritten at the canvas.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
|
||||
|
||||
Reference in new issue
Block a user