def _resize_field(self, field, width, height): width = clamp(width, 1, self.width - field.x - 1) height = clamp(height, 1, self.height - field.y - 1) if field.width == width and field.height == height: return field.width, field.height = width, height if field.widget.props.visible: self.queue_resize() self.emit('selection-changed', field)
def _set_field_position(self, field, x, y): x = clamp(x, 0, self.width - field.width - 1) y = clamp(y, 0, self.height - field.height - 1) if field.x == x and field.y == y: return field.x, field.y = x, y if field.widget.props.visible: self.queue_resize() self.emit('selection-changed', field)