mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-24 21:24:52 +08:00
Merge pull request #2664 from urbanrotnik/ur-sci-4762-v2
Canvas fix [SCI-4762] -v2
This commit is contained in:
commit
d0f0baf6b2
1 changed files with 1 additions and 3 deletions
|
|
@ -60,7 +60,6 @@ class CanvasController < ApplicationController
|
|||
positions = {}
|
||||
if update_params[:positions].present?
|
||||
poss = update_params[:positions].split(';')
|
||||
center = ''
|
||||
(poss.collect { |pos| pos.split(',') }).each_with_index do |pos, index|
|
||||
unless pos.length == 3 && pos[0].is_a?(String) &&
|
||||
float?(pos[1]) && float?(pos[2])
|
||||
|
|
@ -68,8 +67,7 @@ class CanvasController < ApplicationController
|
|||
end
|
||||
x = pos[1].to_i
|
||||
y = pos[2].to_i
|
||||
# Multiple modules cannot have same position
|
||||
return render_403 if positions.any? { |_, v| v[:x] == x && v[:y] == y }
|
||||
|
||||
positions[pos[0]] = { x: x, y: y }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue