almost there
This commit is contained in:
1 parent
72a12c346b
commit
ba66db2907
3 files changed
+19
-8
No files matched your search
@@ -107,7 +107,7 @@ function newEdgeEditor () {
|
||||
function onDoubleClick () {
|
||||
doubleClickCounter = 0
|
||||
|
||||
// canvas.chartingSpace.viewport.displaceToContainer(thisObject.container.parentContainer)
|
||||
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)
|
||||
|
||||
@@ -40,6 +40,7 @@ function newViewport () {
|
||||
fitIntoVisibleArea: fitIntoVisibleArea,
|
||||
fitIntoViewport: fitIntoViewport,
|
||||
displace: displace,
|
||||
displaceToContainer: displaceToContainer,
|
||||
physics: physics,
|
||||
raiseEvents: raiseEvents,
|
||||
resize: resize,
|
||||
@@ -133,10 +134,24 @@ function newViewport () {
|
||||
thisObject.eventHandler.raiseEvent('Position Changed', event)
|
||||
}
|
||||
|
||||
function displaceToContainer (container) {
|
||||
let targetPoint = {
|
||||
x: -container.frame.position.x - container.frame.width / 2,
|
||||
y: -container.frame.position.y - container.frame.height / 2 + TOP_SPACE_HEIGHT
|
||||
}
|
||||
position.x = targetPoint.x + thisObject.width / 2
|
||||
position.y = targetPoint.y + thisObject.height / 2
|
||||
}
|
||||
|
||||
function zoomAtCenter (level) {
|
||||
thisObject.zoomTargetLevel = level
|
||||
overrideMousePositionCounter = 50
|
||||
}
|
||||
|
||||
function mousePositionPhysics () {
|
||||
if (overrideMousePositionCounter > 0) {
|
||||
thisObject.mousePosition.x = browserCanvas.width / 2
|
||||
thisObject.mousePosition.y = (browserCanvas.height - TOP_SPACE_HEIGHT) / 2 + TOP_SPACE_HEIGHT
|
||||
thisObject.mousePosition.y = (browserCanvas.height - TOP_SPACE_HEIGHT) / 2 - TOP_SPACE_HEIGHT / 2
|
||||
|
||||
console.log('SETTING MOUSE TO CENTER', overrideMousePositionCounter, thisObject.zoomLevel, thisObject.zoomTargetLevel)
|
||||
overrideMousePositionCounter--
|
||||
@@ -280,11 +295,6 @@ function newViewport () {
|
||||
thisObject.eventHandler.raiseEvent('Position Changed', event)
|
||||
}
|
||||
|
||||
function zoomAtCenter (level) {
|
||||
thisObject.zoomTargetLevel = level
|
||||
overrideMousePositionCounter = 10
|
||||
}
|
||||
|
||||
function changeZoom (oldLevel, newLevel) {
|
||||
if (thisObject.visible === false) { return }
|
||||
let oldMouse = unTransformThisPoint(thisObject.mousePosition, oldLevel)
|
||||
@@ -406,3 +416,4 @@ function newViewport () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ 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
|
||||
const DOUBLE_CLICK_ZOOM_IN_LEVEL = 7
|
||||
|
||||
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.
|
||||
|
||||
Reference in new issue
Block a user