# Draw line(spline) in ui during drag and drop

**URL:** <https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571>\
**Category:** Programming & Scripting\
**Tags:** draw, drag-and-drop, unreal-engine, UI, Widget\
**Created:** [October 26, 2023, 1:00am UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571 "2023-10-26T01:00:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![DenisKalou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DenisKalou](https://forums.unrealengine.com/u/DenisKalou)\
**Post date:** [October 26, 2023, 1:00am UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571/1 "2023-10-26T01:00:23Z")

</div>

Hello, Can anyone help with problem: I’m trying to draw a line(spline) in widget during drag operation. But as I understand, while drag and drop operation is active it takes player controller and calling Get Mouse Position Scaled by DPI function returns 0,0. As I tested there is another function Get Mouse Position on Viewport, but I assume it is bad practice to call it in game. Is there any possibility to draw line from drag start to mouse cursor?  
Additionally, i’m interested how to draw curved line, filled with some images(i.e. arrows) in widget. I think I should interpolate curve line points and draw widgets from this points. Is there somewhat more clever approach to this problem?

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [October 26, 2023, 3:02am UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571/2 "2023-10-26T03:02:19Z")

</div>

look into the hud class, i know it has drawrect probably has draw line too

---

<div class="post-metadata">

**Author:** ![DenisKalou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DenisKalou](https://forums.unrealengine.com/u/DenisKalou)\
**Post date:** [October 26, 2023, 12:26pm UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571/3 "2023-10-26T12:26:39Z")

</div>

Yes, there is whole pack of methods such as draw line and draw spline and so on. But my question not how to draw, but how to determine end point as mouse position during drag operation.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [October 26, 2023, 3:13pm UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571/4 "2023-10-26T15:13:46Z")

</div>

there is nothing wrong with get mouse position in viewport if thats what you need, or get hit result under cursor if you need the world position or convert between the two

---

<div class="post-metadata">

**Author:** ![DenisKalou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DenisKalou](https://forums.unrealengine.com/u/DenisKalou)\
**Post date:** [October 26, 2023, 3:41pm UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571/5 "2023-10-26T15:41:31Z")

</div>

Thanks a lot. I’m trying to make card hand system in widgets. Still learning and trying to implement “Slay the spire” like arrow from card to target when dragging it. I`m just afraid that viewport mouse position is wrong because coordinates goes outside viewport instead of 0 to max viewport size an in mouse coordinates from controller.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [October 26, 2023, 3:51pm UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571/6 "2023-10-26T15:51:22Z")

</div>

im not sure how coordinates would go outside viewport but can just clamp them if thats the case

---

<div class="post-metadata">

**Author:** ![DenisKalou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DenisKalou](https://forums.unrealengine.com/u/DenisKalou)\
**Post date:** [October 26, 2023, 4:27pm UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571/7 "2023-10-26T16:27:05Z")

</div>

Again thanks for help. Clamping to GetPlayerScreenWigdetGeometry Local Size made the thing if someone will accure same problem as me.

---

<div class="post-metadata">

**Author:** ![DenisKalou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DenisKalou](https://forums.unrealengine.com/u/DenisKalou)\
**Post date:** [October 26, 2023, 4:30pm UTC](https://forums.unrealengine.com/t/draw-line-spline-in-ui-during-drag-and-drop/1345571/8 "2023-10-26T16:30:09Z")

</div>

But I have another problem: determine how to draw curved line contains images(i.e. arrows) or just custom line for example tappering to the end in widget. I can use plugin from marketplace, but I just can’t buy it for now.
