示例#1
0
    def resize(self, x, y):
        direction = self.direction

        position = Position()
        position.x = self.x
        position.y = self.y

        size = Size()
        size.width = self.width
        size.height = self.height

        side = get_side(direction)

        if side is not VERTICAL:
            size.width = x - self.pivot.x
            if size.width < 0:
                position.x = x
            else:
                position.x = self.pivot.x

        if side is not HORIZONTAL:
            size.height = y - self.pivot.y
            if size.height < 0:
                position.y = y
            else:
                position.y = self.pivot.y

        self.set_position(position)
        self.set_size(size)
示例#2
0
    def resize(self, x, y):
        direction = self.direction

        position = Position()
        position.x = self.x
        position.y = self.y

        size = Size()
        size.width = self.width
        size.height = self.height

        side = get_side(direction)

        if side is not VERTICAL:
            size.width = x - self.pivot.x
            if size.width < 0:
                position.x = x
            else:
                position.x = self.pivot.x

        if side is not HORIZONTAL:
            size.height = y - self.pivot.y
            if size.height < 0:
                position.y = y
            else:
                position.y = self.pivot.y

        self.set_position(position)
        self.set_size(size)
示例#3
0
文件: box.py 项目: StetHD/sanaviron
    def resize(self, x, y):
        source = Size()
        source.width = self.width
        source.height = self.height
        Object.resize(self, x, y)
        target = Size()
        target.width = self.width
        target.height = self.height

        if len(self.separators) > 0:
            for separator in self.separators:
                if separator.direction == HORIZONTAL and source.height and target.height:
                    separator.position = separator.position / source.height * target.height
                    separator.hidden = False
                elif separator.direction == VERTICAL and source.width and target.width:
                    separator.position = separator.position / source.width * target.width
                    separator.hidden = False
                else:
                    separator.hidden = True
示例#4
0
    def resize(self, x, y):
        source = Size()
        source.width = self.width
        source.height = self.height
        Object.resize(self, x, y)
        target = Size()
        target.width = self.width
        target.height = self.height

        if len(self.separators) > 0:
            for separator in self.separators:
                if separator.direction == HORIZONTAL and source.height and target.height:
                    separator.position = separator.position / source.height * target.height
                    separator.hidden = False
                elif separator.direction == VERTICAL and source.width and target.width:
                    separator.position = separator.position / source.width * target.width
                    separator.hidden = False
                else:
                    separator.hidden = True