def _finalizePositions(self, pos=None):
        finalized = False
        if self._vertical:
            if pos is None:
                pos = self._container1.getOffsetHeight()
            space = self.getOffsetHeight()
            sz = self._splitter.getOffsetHeight()
            if space > 0 and sz > 0 and pos > 0:
                # limit pos
                if pos > space - sz:
                    pos = space - sz
                    self._container1.setHeight(pos)
                self.setWidgetPosition(self._splitter, 0, pos)
                self.setWidgetPosition(self._container2, 0, pos + sz)
                self._container2.setHeight(space - (pos + sz))
                finalized = True
        else:
            if pos is None:
                pos = self._container1.getOffsetWidth()
            space = self.getOffsetWidth()
            sz = self._splitter.getOffsetWidth()
            if space > 0 and sz > 0 and pos > 0:
                # limit pos
                if pos > space - sz:
                    pos = space - sz
                    self._container1.setWidth(pos)
                self.setWidgetPosition(self._splitter, pos, 0)
                self.setWidgetPosition(self._container2, pos + sz, 0)
                self._container2.setWidth(space - (pos + sz))
                finalized = True
        if finalized:
            self.dispatchResizeEvent(self, pos)
        return finalized

    # end a drag operation
dataset/ETHPy150Open anandology/pyjamas/library/gwt/ui/SplitPanel.py/SplitPanel._finalizePositions/original