Skip to content

Commit 3e8ba01

Browse files
committed
Fix view update bugs in TWOMDataViewer.applyView
Fix some silly bugs that caused the plots to be re-created every time, even when not needed, due to a failure to properly detect differences between the current plots and the active view.
1 parent 94baecc commit 3e8ba01

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

UI/TWOMDataViewer.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,12 @@ function applyView(self)
156156
end
157157

158158
for i = 1:self.view.data.length
159+
plotUserData = { self.view.distChannel self.view.forceChannels{i} };
159160
plot(self.gui.plotfd.axes, [NaN NaN], [NaN NaN], '.');
160-
plot(self.gui.plotft.axes, self.view.data.items{i}.t, self.view.data.items{i}.f, '.');
161-
plot(self.gui.plotdt.axes, self.view.data.items{i}.t, self.view.data.items{i}.d, '.');
161+
plot(self.gui.plotft.axes, self.view.data.items{i}.t, self.view.data.items{i}.f, ...
162+
'.', 'UserData', plotUserData);
163+
plot(self.gui.plotdt.axes, self.view.data.items{i}.t, self.view.data.items{i}.d, ...
164+
'.', 'UserData', plotUserData);
162165
end
163166
end
164167

@@ -207,13 +210,13 @@ function applyView(self)
207210
% >> nested functions
208211
function [b] = n_hasDataSelectionChanged()
209212
currentD = 0;
210-
plots = findobj(self.gui.plotft, 'Type', 'line', '-and', '-not', 'Tag', 'cursor');
213+
plots = findobj(self.gui.plotft.axes, 'Type', 'line', '-and', '-not', 'Tag', 'cursor');
211214
currentFItems = cell(size(plots));
212215
for k = 1:length(plots)
213216
currentD = plots(k).UserData{1};
214217
currentFItems{k} = plots(k).UserData{2};
215218
end
216-
b = ~isequal(sort(currentFItems), sort(self.view.forceChannels)) ...
219+
b = ~isequal(sort(currentFItems(:)), sort(self.view.forceChannels(:))) ...
217220
|| (currentD ~= self.view.distChannel);
218221
end
219222
% << nested functions

0 commit comments

Comments
 (0)