Skip to content

Commit

Permalink
fix(OverlayViewCreator): position container after render
Browse files Browse the repository at this point in the history
* Closes #167
  • Loading branch information
Pete Browne committed Dec 31, 2015
1 parent 693c956 commit f5b0a4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
10 changes: 5 additions & 5 deletions lib/creators/OverlayViewCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ var OverlayViewCreator = (function (_Component) {
};

overlayView.draw = function draw() {
this._renderContent();
this._mountContainerToPane();
this._positionContainerElement();
this._renderContent();
};

overlayView.onRemove = function onRemove() {
Expand All @@ -116,16 +115,17 @@ var OverlayViewCreator = (function (_Component) {
};

overlayView._redraw = function _redraw(mapPaneNameChanged) {
this._renderContent();
if (mapPaneNameChanged) {
this._unmountContainerFromPane();
this._mountContainerToPane();
}
this._positionContainerElement();
this._renderContent();
};

overlayView._renderContent = function _renderContent() {
(0, _reactDom.render)(_react.Children.only(this.get("children")), this._containerElement);
if (this._containerElement) {
(0, _reactDom.render)(_react.Children.only(this.get("children")), this._containerElement, this._positionContainerElement.bind(this));
}
};

overlayView._mountContainerToPane = function _mountContainerToPane() {
Expand Down
17 changes: 9 additions & 8 deletions src/creators/OverlayViewCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ export default class OverlayViewCreator extends Component {
};

overlayView.draw = function draw() {
this._renderContent();
this._mountContainerToPane();
this._positionContainerElement();
this._renderContent();
};

overlayView.onRemove = function onRemove() {
Expand All @@ -65,19 +64,21 @@ export default class OverlayViewCreator extends Component {
};

overlayView._redraw = function _redraw(mapPaneNameChanged) {
this._renderContent();
if (mapPaneNameChanged) {
this._unmountContainerFromPane();
this._mountContainerToPane();
}
this._positionContainerElement();
this._renderContent();
};

overlayView._renderContent = function _renderContent() {
render(
Children.only(this.get(`children`)),
this._containerElement
);
if (this._containerElement) {
render(
Children.only(this.get(`children`)),
this._containerElement,
this._positionContainerElement.bind(this)
);
}
};

overlayView._mountContainerToPane = function _mountContainerToPane() {
Expand Down

0 comments on commit f5b0a4c

Please sign in to comment.