moveTo refactored
This commit is contained in:
1 parent
cdd9d1fc82
commit
711829f46d
3 files changed
+12
-5
No files matched your search
@@ -744,7 +744,7 @@ function newCanvas () {
|
||||
}
|
||||
|
||||
if (containerBeingDragged !== undefined) {
|
||||
let moveSucceed = containerBeingDragged.moveTo(displaceVector)
|
||||
let moveSucceed = containerBeingDragged.displace(displaceVector)
|
||||
if (moveSucceed === false) {
|
||||
deactivateDragging(event)
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ function newContainer () {
|
||||
name: undefined,
|
||||
fitFunction: undefined,
|
||||
isVisibleFunction: undefined,
|
||||
moveTo: moveTo,
|
||||
displace: displace,
|
||||
initialize: initialize,
|
||||
finalize: finalize,
|
||||
connectToParent: connectToParent,
|
||||
@@ -188,8 +188,8 @@ function newContainer () {
|
||||
return false
|
||||
}
|
||||
|
||||
function moveTo (point) {
|
||||
/* This function will move the container to the destination point. If it has a visible function will use it
|
||||
function displace (point) {
|
||||
/* This function will move the container according to the vector received. If it has a visible function will use it
|
||||
to see if the container can be moved there or not. It wont if the center will not be visible.
|
||||
|
||||
Returns true if move was possible, false if not. */
|
||||
|
||||
@@ -90,6 +90,14 @@ function newStrategyPartTitle () {
|
||||
function getContainer (point) {
|
||||
let container
|
||||
|
||||
if (thisObject.editMode === true) {
|
||||
if (point.x === VERY_LARGE_NUMBER) {
|
||||
/* The the mouse leaves the canvas, and event of mouse over with a ridiculous coordinate is triggered so that
|
||||
anyone can react. In our case, this object has an html input element that is not part of the canvas, so the event is
|
||||
triggered. We compensate recognizing this coordinate and returning our container. */
|
||||
return thisObject.container
|
||||
}
|
||||
}
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
return thisObject.container
|
||||
} else {
|
||||
@@ -233,4 +241,3 @@ function newStrategyPartTitle () {
|
||||
return title
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user