Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- /tmp/GridLayout.m
- +++ /home/eacousineau/Dropbox/amber/proj/util/manip_gui/third/GridLayout/GridLayout.m
- @@ -1,3 +1,5 @@
- +% Change in GridLayout.ResizeCell() - eacousineau
- +% Enable non-figure parents in constructor, Parent
- classdef GridLayout < handle
- properties
- @@ -50,7 +52,7 @@
- NamesCell = CellProps.GetCellParamNames();
- [P, PC] = ParseArgs(varargin, Names, NamesCell);
- - if isempty(Parent) || ~ishghandle(Parent)
- + if isempty(Parent) % || ~ishghandle(Parent)
- Parent = gcf;
- end
- Obj.Container = uicontainer( ...
- @@ -318,8 +320,21 @@
- end
- assert(isscalar(Child), ...
- 'Cell has more than one child. This is not allowed.');
- +
- + IsAxes = false;
- + % Use bugfix from layout.GridBagLayout.layout(this)
- + % http://www.mathworks.com/matlabcentral/fileexchange/22968-gridbaglayout/
- + if ishghandle(Child, 'axes') && ...
- + strcmp(get(Child, 'ActivePositionProperty'), 'outerposition')
- + IsAxes = true;
- + OldUnits = get(Child, 'Units');
- + set(Child, 'Units', 'Pixels');
- + ChildPosition = get(Child, 'OuterPosition');
- + else
- + ChildPosition = get(Child, 'Position');
- + end
- +
- % Child offset and size
- - ChildPosition = get(Child,'Position');
- ChildOffset = ChildPosition(1:2);
- ChildSize = ChildPosition(3:4);
- % Cell size
- @@ -356,7 +371,12 @@
- % Prevent non-positive sizes
- ChildSize = max(ChildSize,.1);
- % Update child position
- - set(Child,'Position',[ChildOffset ChildSize]);
- + ChildPosition = [ChildOffset ChildSize];
- + if ~IsAxes
- + set(Child,'Position', ChildPosition);
- + else
- + set(Child, 'OuterPosition', ChildPosition, 'Units', OldUnits);
- + end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement