I have a problem with QML, I need to create a Rectangle when I do a double click on MouseArea.

The problem is that the Rectangle appears just below the mouse pointer, never in the exact position.
Can anyone tell what's wrong and how can I solve this problem.

Qt Code:
  1. Rectangle {
  2. id: root
  3. width: 360
  4. height: 360
  5. color: "white"
  6.  
  7. //Initial Values
  8. property int mousePosX: 0
  9. property int mousePosY: 0
  10. property bool showReservoir: false
  11.  
  12. MouseArea {
  13. id: drawArea
  14. anchors.fill: parent
  15. onDoubleClicked: {
  16. var pos = mapToItem(drawArea, mouse.x, mouse.y)
  17. drawReservoir(Math.abs(pos.x), Math.abs(pos.y))
  18. }
  19. }
  20.  
  21. Reservoir {
  22. id: m_nodeReservoir
  23. width: 60
  24. height: 60
  25. }
  26.  
  27. function drawReservoir(positionX, positionY)
  28. {
  29. m_nodeReservoir.x = positionX
  30. m_nodeReservoir.y = positionY
  31. m_nodeReservoir.visible = true
  32. }
  33. }
To copy to clipboard, switch view to plain text mode 

Thanks!!