WIP: bug fixes

This commit is contained in:
Matthias Koefferlein 2022-03-06 18:48:23 +01:00
parent f681d96558
commit 33cd9fe687
3 changed files with 21 additions and 2 deletions

View File

@ -38,7 +38,8 @@ const double initial_elevation = 15.0;
D25View::D25View (lay::Dispatcher *root, lay::LayoutView *view)
: lay::Browser (root, view, "d25_view"),
dm_rerun_macro (this, &D25View::rerun_macro)
dm_rerun_macro (this, &D25View::rerun_macro),
dm_fit (this, &D25View::fit)
{
mp_ui = new Ui::D25View ();
mp_ui->setupUi (this);
@ -207,13 +208,20 @@ D25View::finish ()
mp_ui->d25_view->reset ();
mp_ui->d25_view->set_cam_azimuth (0.0);
mp_ui->d25_view->set_cam_elevation (-initial_elevation);
mp_ui->d25_view->fit ();
// NOTE: needs to be delayed to allow the geometry to be updated before (initial call)
dm_fit ();
mp_ui->gl_stack->setCurrentIndex (0);
}
}
void
D25View::fit ()
{
mp_ui->d25_view->fit ();
}
static QString scale_factor_to_string (double f)
{
return QString (QString::fromUtf8 ("%1")).arg (f, 0, 'g', 3);

View File

@ -88,11 +88,13 @@ private slots:
private:
Ui::D25View *mp_ui;
tl::DeferredMethod<D25View> dm_rerun_macro;
tl::DeferredMethod<D25View> dm_fit;
std::string m_generator;
void cellviews_changed ();
void layer_properties_changed (int);
void rerun_macro ();
void fit ();
};
}

View File

@ -592,6 +592,15 @@ D25ViewWidget::entry (const db::Region &data, double dbu, double zstart, double
{
tl_assert (m_display_open);
if (! m_zset) {
m_zmin = std::min (zstart, zstop);
m_zmax = std::max (zstart, zstop);
m_zset = true;
} else {
m_zmin = std::min (m_zmin, std::min (zstart, zstop));
m_zmax = std::min (m_zmax, std::max (zstart, zstop));
}
// try to establish a default color from the region's origin if required
const db::OriginalLayerRegion *original_region = dynamic_cast<db::OriginalLayerRegion *> (data.delegate ());
if (mp_view && m_layers.back ().fill_color [3] == 0.0 && m_layers.back ().frame_color [3] == 0.0) {