~ubuntu-branches/ubuntu/quantal/kde-runtime/quantal

« back to all changes in this revision

Viewing changes to plasma/declarativeimports/plasmacomponents/platformcomponents/touch/EditBubble.js

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-06-03 21:50:00 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20120603215000-vn7oarsq0ynrydj5
Tags: upstream-4.8.80
Import upstream version 4.8.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function placeEditBubble(mouse) {
 
2
    // Find the root item, then map our cursor position to it
 
3
    // in order to check if the edit bubble could end up off-screen
 
4
    var rootItem = parent;
 
5
    while (rootItem.parent) {
 
6
        rootItem = rootItem.parent;
 
7
    }
 
8
    var distanceToTop = mouseEventListener.mapToItem(rootItem, mouse.x, mouse.y);
 
9
    //print( "   distanceToTop: " + distanceToTop.x);
 
10
    if (distanceToTop.x < editBubble.width/2) {
 
11
        // hitting the left edge
 
12
        //editBubble.x = mouse.x
 
13
 
 
14
    } else {
 
15
        editBubble.x = mouse.x-(editBubble.width/2)
 
16
    }
 
17
    if (distanceToTop.y > editBubble.height) {
 
18
        editBubble.y = mouse.y-editBubble.height-8
 
19
    } else {
 
20
        //editBubble.y = mouse.y-(editBubble.width/2)
 
21
    }
 
22
 
 
23
}