I’m making a pannable node-based editor where you click on a node to move it. When the editor isn’t panned at all, there are no problems. But when you pan the editor, when you move a node, it’s position is offsetted to the mouse position. How would I fix this?
Video example:
Node Move Script (Move function just move’s the node to the position stated in the first parameter) :
local node = NodeEditor.new(NodeEditor.NodeType[v.Name])
local moving = true
node.UI.Button.MouseButton1Click:Connect(function()
if moving == false then
moving = true
else
moving = false
end
end)
moving = true
coroutine.wrap(function()
while true do
wait()
if moving == true then
local mouse = game.Players.LocalPlayer:GetMouse()
node:Move(UDim2.fromOffset(mouse.X,mouse.Y))
end
end
end)()