Help with drag building

hello, pls check the attached image to see what i want to do…

help.png

i want to be able to do something like drag building…
i need help how.

currently i have thought out this, but getting confused…

start

Left Click : Spawn Actor 1 : [var: Actor 1 Location]

When Holding Left Click
Current Mouse Location : [var: Current Mouse Location]

Get
> [Actor 1 X Location] distance to [Current Mouse X Location] (get Length) : [var: XX]
> [Actor 1 Y Location] distance to [Current Mouse Y Location] (get Length) : [var: YY]

If XX distance is greater than YY
Then Lock Line to X axis
Hold Y coordinate (Because player is dragging to Left or to Right )
Else
Then Lock Line to Y Axis
Hold X coordinate (Because player is dragging to Up or to Down )


now im stuck here, how do i let the blueprint to know how many to spawn cubes and what location...

im using 32 pixel / 32uu for the gridsize