-
Notifications
You must be signed in to change notification settings - Fork 2
/
plotBrowserColorState.m
90 lines (87 loc) · 3.58 KB
/
plotBrowserColorState.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
classdef plotBrowserColorState < plotBrowserState
%PLOTBROWSERCOLORSTATE State class for the plotBrowser. For hiding objects by changing their color.
%
%SEE ALSO: plotBrowser
methods
function s = plotBrowserColorState(p)
s@plotBrowserState(p)
end
function show(s, obj)
show@plotBrowserState(s, obj)
obj.Visible = 'on'; % in case it was set to off by other state
try
visibleColor = obj.UserData.plotBrowserData.visibleColor;
visibleMarkerColor = obj.UserData.plotBrowserData.visibleMarkerColor;
visibleMarkerFaceColor = obj.UserData.plotBrowserData.visibleMarkerFaceColor;
visibleMarkerEdgeColor = obj.UserData.plotBrowserData.visibleMarkerEdgeColor;
visibleYColor = obj.UserData.plotBrowserData.visibleYColor;
visibleXColor = obj.UserData.plotBrowserData.visibleXColor;
catch
visibleColor = [];
visibleMarkerColor = [];
visibleMarkerFaceColor = [];
visibleMarkerEdgeColor = [];
visibleYColor = [];
visibleXColor = [];
end
if ~isempty(visibleColor)
obj.Color = visibleColor;
end
if ~isempty(visibleMarkerColor)
obj.MarkerColor = visibleMarkerColor;
end
if ~isempty(visibleMarkerFaceColor)
obj.MarkerFaceColor = visibleMarkerFaceColor;
end
if ~isempty(visibleMarkerEdgeColor)
obj.MarkerEdgeColor = visibleMarkerEdgeColor;
end
if ~isempty(visibleYColor)
obj.YColor = visibleYColor;
end
if ~isempty(visibleXColor)
obj.XColor = visibleXColor;
end
end
function hide(s, obj)
hide@plotBrowserState(s, obj)
backgroundColor = s.plotBrowserObj.hiddenColor;
try
visibleMarkerColor = obj.MarkerColor;
obj.MarkerColor = backgroundColor;
catch
visibleMarkerColor = [];
end
try
visibleMarkerFaceColor = obj.MarkerFaceColor;
visibleMarkerEdgeColor = obj.MarkerEdgeColor;
obj.MarkerFaceColor = backgroundColor;
obj.MarkerEdgeColor = backgroundColor;
catch
visibleMarkerFaceColor = [];
visibleMarkerEdgeColor = [];
end
try
visibleYColor = obj.YColor;
visibleXColor = obj.XColor;
obj.YColor = backgroundColor;
obj.XColor = backgroundColor;
catch
visibleYColor = [];
visibleXColor = [];
end
try
visibleColor = obj.Color;
obj.Color = backgroundColor;
catch
visibleColor = [];
end
obj.UserData.plotBrowserData.visibleMarkerColor = visibleMarkerColor;
obj.UserData.plotBrowserData.visibleMarkerFaceColor = visibleMarkerFaceColor;
obj.UserData.plotBrowserData.visibleMarkerEdgeColor = visibleMarkerEdgeColor;
obj.UserData.plotBrowserData.visibleYColor = visibleYColor;
obj.UserData.plotBrowserData.visibleXColor = visibleXColor;
obj.UserData.plotBrowserData.visibleColor = visibleColor;
end
end
end