     mousPos = @getMousePos event
     pos = @getGridCoordinates mousPos
     objOnPos = @isSomethingOnPosition pos.x, pos.y
-    if !Simulation.isSimulating && objOnPos == false && @mousePressed == 1
+    if !Simulation.isSimulating && objOnPos == false && @mousePressed == 1 && @contains(@getMousePos(event))
       @GridControls.creatObjectFromButton pos.x, pos.y
     else if @mousePressed == 3 && objOnPos != false
       @deleteObjectWithIndex @objects.indexOf(objOnPos)

      coords.y <= @gridHeight*@size

  @getGridCoordinates = (coords) ->
    new Coordinate Math.floor(coords.x/@size), Math.floor(coords.y/@size)

  @getCanvasCoordinates = (coords) ->
    new Coordinate Math.floor(coords.x*@size), Math.floor(coords.y*@size)

      else if event.which == 3 && objOnPos != false
        @deleteObjectWithIndex @objects.indexOf(objOnPos)


  @onMouseUp = (event) =>
    @mousePressed = false
    coords = @getGridCoordinates @getMousePos(event)
