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