# How can I limit the dragging line to the edge of my project area

**URL:** <https://forum.inductiveautomation.com/t/how-can-i-limit-the-dragging-line-to-the-edge-of-my-project-area/44357>\
**Category:** Ignition\
**Created:** [March 11, 2021, 11:18am UTC](https://forum.inductiveautomation.com/t/how-can-i-limit-the-dragging-line-to-the-edge-of-my-project-area/44357 "2021-03-11T11:18:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 11, 2021, 11:18am UTC](https://forum.inductiveautomation.com/t/how-can-i-limit-the-dragging-line-to-the-edge-of-my-project-area/44357/1 "2021-03-11T11:18:04Z")

</div>

Hi i am using a Line and i am dragging in it window.

but i want limit the dragging at edge of the window

please let me know how to limit dragging near to edge of the window

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/45c333ecffb8490ed312904b1681ac643699ea08.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 11, 2021, 1:02pm UTC](https://forum.inductiveautomation.com/t/how-can-i-limit-the-dragging-line-to-the-edge-of-my-project-area/44357/2 "2021-03-11T13:02:21Z")

</div>

Just use a condition?

```auto
line = event.source
window = system.gui.getParentWindow(event)
mouseX = event.x
screenEdgeDeadband = 100

if mouseX >= screenEdgeDeadband and mouseX <= (window.width - screenEdgeDeadband)
    lineX = line.getX()
    lineY = line.getY()
    newLineX = lineX + mouseX
    system.gui.transform(line, newLineX, lineY, duration = 10)

```

Note: I didn’t test this, but the concept is the same. If there is a position where you don’t want the transform to happen block it with a conditional statement.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 11, 2021, 1:28pm UTC](https://forum.inductiveautomation.com/t/how-can-i-limit-the-dragging-line-to-the-edge-of-my-project-area/44357/3 "2021-03-11T13:28:45Z")

</div>

> [@lrose](#):
>
> line = event.source window = system.gui.getParentWindow(event) mouseX = event.x screenEdgeDeadband = 100 if mouseX \>= screenEdgeDeadband and mouseX \<= (window.width - screenEdgeDeadband) lineX = line.getX() lineY = line.getY() newLineX = lineX + mouseX system.gui.transform(line, newLineX, lineY, duration = 10)

its not working. i will try this concept
