2011-12-01 03:49:28 +01:00
|
|
|
function placeEditBubble(mouse) {
|
|
|
|
// Find the root item, then map our cursor position to it
|
|
|
|
// in order to check if the edit bubble could end up off-screen
|
|
|
|
var rootItem = parent;
|
|
|
|
while (rootItem.parent) {
|
|
|
|
rootItem = rootItem.parent;
|
|
|
|
}
|
|
|
|
var distanceToTop = mouseEventListener.mapToItem(rootItem, mouse.x, mouse.y);
|
2012-04-01 00:15:30 +02:00
|
|
|
//print( " distanceToTop: " + distanceToTop.x);
|
2011-12-01 03:49:28 +01:00
|
|
|
if (distanceToTop.x < editBubble.width/2) {
|
|
|
|
// hitting the left edge
|
|
|
|
//editBubble.x = mouse.x
|
|
|
|
|
|
|
|
} else {
|
|
|
|
editBubble.x = mouse.x-(editBubble.width/2)
|
|
|
|
}
|
|
|
|
if (distanceToTop.y > editBubble.height) {
|
|
|
|
editBubble.y = mouse.y-editBubble.height-8
|
|
|
|
} else {
|
|
|
|
//editBubble.y = mouse.y-(editBubble.width/2)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|