Fix selectors jumping when zooming
This commit is contained in:
parent
140b66862a
commit
4cb7e8a9aa
4 changed files with 32 additions and 75 deletions
|
@ -764,7 +764,7 @@
|
||||||
<property name="widgetResizable">
|
<property name="widgetResizable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_3">
|
<widget class="QWidget" name="scrollAreaWidgetContents_BorderMetatiles">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -883,7 +883,7 @@
|
||||||
<property name="widgetResizable">
|
<property name="widgetResizable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_6">
|
<widget class="QWidget" name="scrollAreaWidgetContents_SelectedMetatiles">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -984,7 +984,7 @@
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
<widget class="QWidget" name="scrollAreaWidgetContents_MetatileSelector">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1184,11 +1184,11 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="3">
|
<item row="5" column="0" colspan="3">
|
||||||
<widget class="QScrollArea" name="scrollArea_1">
|
<widget class="QScrollArea" name="scrollArea_Collision">
|
||||||
<property name="widgetResizable">
|
<property name="widgetResizable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
<widget class="QWidget" name="scrollAreaWidgetContents_Collision">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
|
|
@ -58,9 +58,9 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
<widget class="QWidget" name="scrollAreaWidgetContents_Metatiles">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -85,20 +85,7 @@
|
||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="1">
|
<item row="0" column="0">
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QGraphicsView" name="graphicsView_Metatiles">
|
<widget class="QGraphicsView" name="graphicsView_Metatiles">
|
||||||
<property name="verticalScrollBarPolicy">
|
<property name="verticalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
|
@ -108,28 +95,15 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>40</height>
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
@ -561,9 +535,9 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
<widget class="QWidget" name="scrollAreaWidgetContents_Tiles">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -585,20 +559,7 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="2">
|
<item row="0" column="0">
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QGraphicsView" name="graphicsView_Tiles">
|
<widget class="QGraphicsView" name="graphicsView_Tiles">
|
||||||
<property name="verticalScrollBarPolicy">
|
<property name="verticalScrollBarPolicy">
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
|
@ -608,8 +569,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="0">
|
||||||
<spacer name="verticalSpacer_4">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -621,19 +582,6 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -734,10 +734,10 @@ void MainWindow::refreshMapScene()
|
||||||
ui->graphicsView_Metatiles->setFixedSize(editor->metatile_selector_item->pixmap().width() + 2, editor->metatile_selector_item->pixmap().height() + 2);
|
ui->graphicsView_Metatiles->setFixedSize(editor->metatile_selector_item->pixmap().width() + 2, editor->metatile_selector_item->pixmap().height() + 2);
|
||||||
|
|
||||||
ui->graphicsView_BorderMetatile->setScene(editor->scene_selected_border_metatiles);
|
ui->graphicsView_BorderMetatile->setScene(editor->scene_selected_border_metatiles);
|
||||||
ui->graphicsView_BorderMetatile->setFixedSize(editor->selected_border_metatiles_item->pixmap().width() + 2, editor->selected_border_metatiles_item->pixmap().height() + 2);
|
ui->graphicsView_BorderMetatile->setFixedSize(editor->selected_border_metatiles_item->pixmap().width(), editor->selected_border_metatiles_item->pixmap().height());
|
||||||
|
|
||||||
ui->graphicsView_currentMetatileSelection->setScene(editor->scene_current_metatile_selection);
|
ui->graphicsView_currentMetatileSelection->setScene(editor->scene_current_metatile_selection);
|
||||||
ui->graphicsView_currentMetatileSelection->setFixedSize(editor->current_metatile_selection_item->pixmap().width() + 2, editor->current_metatile_selection_item->pixmap().height() + 2);
|
ui->graphicsView_currentMetatileSelection->setFixedSize(editor->current_metatile_selection_item->pixmap().width(), editor->current_metatile_selection_item->pixmap().height());
|
||||||
|
|
||||||
ui->graphicsView_Collision->setScene(editor->scene_collision_metatiles);
|
ui->graphicsView_Collision->setScene(editor->scene_collision_metatiles);
|
||||||
//ui->graphicsView_Collision->setSceneRect(editor->scene_collision_metatiles->sceneRect());
|
//ui->graphicsView_Collision->setSceneRect(editor->scene_collision_metatiles->sceneRect());
|
||||||
|
@ -1373,7 +1373,8 @@ void MainWindow::redrawMetatileSelection()
|
||||||
transform.scale(scale, scale);
|
transform.scale(scale, scale);
|
||||||
|
|
||||||
ui->graphicsView_currentMetatileSelection->setTransform(transform);
|
ui->graphicsView_currentMetatileSelection->setTransform(transform);
|
||||||
ui->graphicsView_currentMetatileSelection->setFixedSize(editor->current_metatile_selection_item->pixmap().width() * scale + 2, editor->current_metatile_selection_item->pixmap().height() * scale + 2);
|
ui->graphicsView_currentMetatileSelection->setFixedSize(editor->current_metatile_selection_item->pixmap().width() * scale, editor->current_metatile_selection_item->pixmap().height() * scale);
|
||||||
|
ui->scrollAreaWidgetContents_SelectedMetatiles->adjustSize();
|
||||||
|
|
||||||
QPoint size = editor->metatile_selector_item->getSelectionDimensions();
|
QPoint size = editor->metatile_selector_item->getSelectionDimensions();
|
||||||
if (size.x() == 1 && size.y() == 1) {
|
if (size.x() == 1 && size.y() == 1) {
|
||||||
|
@ -2828,8 +2829,11 @@ void MainWindow::on_horizontalSlider_MetatileZoom_valueChanged(int value) {
|
||||||
ui->graphicsView_Metatiles->setFixedSize(size.width() + 2, size.height() + 2);
|
ui->graphicsView_Metatiles->setFixedSize(size.width() + 2, size.height() + 2);
|
||||||
|
|
||||||
ui->graphicsView_BorderMetatile->setTransform(transform);
|
ui->graphicsView_BorderMetatile->setTransform(transform);
|
||||||
ui->graphicsView_BorderMetatile->setFixedSize(ceil(static_cast<double>(editor->selected_border_metatiles_item->pixmap().width()) * scale) + 2,
|
ui->graphicsView_BorderMetatile->setFixedSize(ceil(static_cast<double>(editor->selected_border_metatiles_item->pixmap().width()) * scale),
|
||||||
ceil(static_cast<double>(editor->selected_border_metatiles_item->pixmap().height()) * scale) + 2);
|
ceil(static_cast<double>(editor->selected_border_metatiles_item->pixmap().height()) * scale));
|
||||||
|
|
||||||
|
ui->scrollAreaWidgetContents_MetatileSelector->adjustSize();
|
||||||
|
ui->scrollAreaWidgetContents_BorderMetatiles->adjustSize();
|
||||||
|
|
||||||
redrawMetatileSelection();
|
redrawMetatileSelection();
|
||||||
}
|
}
|
||||||
|
@ -2847,6 +2851,7 @@ void MainWindow::on_horizontalSlider_CollisionZoom_valueChanged(int value) {
|
||||||
ui->graphicsView_Collision->setResizeAnchor(QGraphicsView::NoAnchor);
|
ui->graphicsView_Collision->setResizeAnchor(QGraphicsView::NoAnchor);
|
||||||
ui->graphicsView_Collision->setTransform(transform);
|
ui->graphicsView_Collision->setTransform(transform);
|
||||||
ui->graphicsView_Collision->setFixedSize(size.width() + 2, size.height() + 2);
|
ui->graphicsView_Collision->setFixedSize(size.width() + 2, size.height() + 2);
|
||||||
|
ui->scrollAreaWidgetContents_Collision->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_spinBox_SelectedCollision_valueChanged(int collision) {
|
void MainWindow::on_spinBox_SelectedCollision_valueChanged(int collision) {
|
||||||
|
|
|
@ -1204,6 +1204,8 @@ void TilesetEditor::redrawMetatileSelector() {
|
||||||
|
|
||||||
QPoint pos = this->metatileSelector->getMetatileIdCoordsOnWidget(this->getSelectedMetatileId());
|
QPoint pos = this->metatileSelector->getMetatileIdCoordsOnWidget(this->getSelectedMetatileId());
|
||||||
pos *= scale;
|
pos *= scale;
|
||||||
|
|
||||||
|
this->ui->scrollAreaWidgetContents_Metatiles->adjustSize();
|
||||||
this->ui->scrollArea_Metatiles->ensureVisible(pos.x(), pos.y(), 8 * scale, 8 * scale);
|
this->ui->scrollArea_Metatiles->ensureVisible(pos.x(), pos.y(), 8 * scale, 8 * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1223,6 +1225,8 @@ void TilesetEditor::redrawTileSelector() {
|
||||||
this->ui->graphicsView_Tiles->setTransform(transform);
|
this->ui->graphicsView_Tiles->setTransform(transform);
|
||||||
this->ui->graphicsView_Tiles->setFixedSize(size.width() + 2, size.height() + 2);
|
this->ui->graphicsView_Tiles->setFixedSize(size.width() + 2, size.height() + 2);
|
||||||
|
|
||||||
|
this->ui->scrollAreaWidgetContents_Tiles->adjustSize();
|
||||||
|
|
||||||
auto tiles = this->tileSelector->getSelectedTiles();
|
auto tiles = this->tileSelector->getSelectedTiles();
|
||||||
if (!tiles.isEmpty()) {
|
if (!tiles.isEmpty()) {
|
||||||
QPoint pos = this->tileSelector->getTileCoordsOnWidget(tiles[0].tileId);
|
QPoint pos = this->tileSelector->getTileCoordsOnWidget(tiles[0].tileId);
|
||||||
|
|
Loading…
Reference in a new issue