mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 17:51:13 +08:00
Fix creation of new tasks on canvas [SCI-4171]
This commit is contained in:
parent
8d22bf6f2e
commit
b945171f2f
1 changed files with 2 additions and 8 deletions
|
@ -66,14 +66,8 @@ class CanvasController < ApplicationController
|
||||||
float?(pos[1]) && float?(pos[2])
|
float?(pos[1]) && float?(pos[2])
|
||||||
return render_403
|
return render_403
|
||||||
end
|
end
|
||||||
if index.zero?
|
x = pos[1].to_i
|
||||||
center = pos
|
y = pos[2].to_i
|
||||||
x = 0
|
|
||||||
y = 0
|
|
||||||
else
|
|
||||||
x = pos[1].to_i - center[1].to_i
|
|
||||||
y = pos[2].to_i - center[2].to_i
|
|
||||||
end
|
|
||||||
# Multiple modules cannot have same position
|
# Multiple modules cannot have same position
|
||||||
return render_403 if positions.any? { |_, v| v[:x] == x && v[:y] == y }
|
return render_403 if positions.any? { |_, v| v[:x] == x && v[:y] == y }
|
||||||
positions[pos[0]] = { x: x, y: y }
|
positions[pos[0]] = { x: x, y: y }
|
||||||
|
|
Loading…
Reference in a new issue