Skip to content
Snippets Groups Projects
Commit 969bbbcc authored by François  LAURENT's avatar François LAURENT
Browse files

fix: prevent resizing during length editing

parent de7e91f2
No related branches found
No related tags found
1 merge request!2UX improvements
...@@ -34,7 +34,6 @@ const bonito_app = NamedApp(:inherit, Backbone.app) ...@@ -34,7 +34,6 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
@out export_sequence_link = "" @out export_sequence_link = ""
@in export_sequence_click = false @in export_sequence_click = false
#@in delete_sequence_click = false
@in colormap = default_colormap @in colormap = default_colormap
@out first_time_in_editmode = true # and in the heatmap view @out first_time_in_editmode = true # and in the heatmap view
...@@ -77,6 +76,7 @@ const bonito_app = NamedApp(:inherit, Backbone.app) ...@@ -77,6 +76,7 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
series_length = length(seq.times) series_length = length(seq.times)
time_interval = step(seq.times) time_interval = step(seq.times)
start_time = first(seq.times) start_time = first(seq.times)
no_sequences_yet = isempty(sequence_names)
end end
on(MuscleWidgets.clipboard(model)) do _ on(MuscleWidgets.clipboard(model)) do _
new_clipboard_item[!] = false new_clipboard_item[!] = false
...@@ -108,24 +108,29 @@ const bonito_app = NamedApp(:inherit, Backbone.app) ...@@ -108,24 +108,29 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
end end
valid = false valid = false
end end
previous_length = length(seq.times)
new_length = round(Int, series_length)
if series_length < 1 if series_length < 1
@notify "Time series length must be strictly positive" :error @notify "Time series length must be strictly positive" :error
series_length = length(seq.times) series_length = previous_length
valid = false valid = false
elseif round(series_length) != series_length elseif series_length != new_length
@notify "Time series length must be an integer" :error @notify "Time series length must be an integer" :error
series_length = round(series_length) series_length = new_length
valid = false valid = false
elseif !isnothing(maxlength) && maxlength < series_length elseif !isnothing(maxlength) && maxlength < new_length
@notify "Time series is too long" :error @notify "Time series is too long" :error
series_length = length(seq.times) series_length = previous_length
valid = false
elseif new_length < previous_length &&
startswith(string(previous_length), string(new_length))
@debug "Ignoring new size at the moment"
valid = false valid = false
end end
# #
if valid && !(start_time == seq.times[1] && time_interval == step(seq.times) && if valid && !(start_time == seq.times[1] && time_interval == step(seq.times) &&
series_length == length(seq.times)) new_length == previous_length)
n = round(Int, series_length) stop_time = start_time + (new_length - 1) * time_interval
stop_time = start_time + (n-1) * time_interval
ts = start_time:time_interval:stop_time ts = start_time:time_interval:stop_time
@info "Resampling" start_time time_interval series_length @info "Resampling" start_time time_interval series_length
MuscleActivities.resample!(seq, ts) MuscleActivities.resample!(seq, ts)
...@@ -276,15 +281,16 @@ const bonito_app = NamedApp(:inherit, Backbone.app) ...@@ -276,15 +281,16 @@ const bonito_app = NamedApp(:inherit, Backbone.app)
if !(sequence.program_name in sequence_names) if !(sequence.program_name in sequence_names)
push!(sequence_names, sequence.program_name) push!(sequence_names, sequence.program_name)
end end
notify(sequence_names)
selected_sequence_name = sequence.program_name selected_sequence_name = sequence.program_name
# enable the download and delete buttons
no_sequences_yet = false
catch exception catch exception
@error "Failed to load file" exception @error "Failed to load file" exception
@notify "Failed to load file" :error @notify "Failed to load file" :error
end end
# reset # reset
fileuploads = empty!(fileuploads) fileuploads = empty!(fileuploads)
# enable the download and delete buttons
no_sequences_yet = false
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment