@@ -118,8 +118,8 @@ FactoryReport::FactoryReport() :
118
118
119
119
add (lstProducts, {cboFilterByProduct.rect ().position .x + cboFilterByProduct.rect ().size .x + 20 , mRect .position .y + 230 });
120
120
121
- txtProductDescription .height (128 );
122
- txtProductDescription .textColor (constants::PrimaryTextColor);
121
+ mTxtProductDescription .height (128 );
122
+ mTxtProductDescription .textColor (constants::PrimaryTextColor);
123
123
124
124
fillLists ();
125
125
}
@@ -140,7 +140,7 @@ void FactoryReport::clearSelected()
140
140
{
141
141
lstFactoryList.clearSelected ();
142
142
selectedFactory = nullptr ;
143
- txtProductDescription .text (" " );
143
+ mTxtProductDescription .text (" " );
144
144
}
145
145
146
146
@@ -270,8 +270,8 @@ void FactoryReport::onResize()
270
270
lstProducts.size ({detailPanelRect.size .x / 3 , detailPanelRect.size .y - 219 });
271
271
lstProducts.selectionChanged ().connect ({this , &FactoryReport::onProductSelectionChange});
272
272
273
- txtProductDescription .position (lstProducts.rect ().crossXPoint () + NAS2D::Vector{158 , 0 });
274
- txtProductDescription .width (mRect .size .x - txtProductDescription .positionX () - 30 );
273
+ mTxtProductDescription .position (lstProducts.rect ().crossXPoint () + NAS2D::Vector{158 , 0 });
274
+ mTxtProductDescription .width (mRect .size .x - mTxtProductDescription .positionX () - 30 );
275
275
}
276
276
277
277
@@ -289,7 +289,7 @@ void FactoryReport::onVisibilityChange(bool visible)
289
289
290
290
if (selectedProductType != ProductType::PRODUCT_NONE)
291
291
{
292
- txtProductDescription .text (ProductCatalogue::get (selectedProductType).Description );
292
+ mTxtProductDescription .text (ProductCatalogue::get (selectedProductType).Description );
293
293
}
294
294
}
295
295
@@ -414,6 +414,15 @@ void FactoryReport::onListSelectionChange()
414
414
lstProducts.selectIf ([productType = selectedFactory->productType ()](const auto & item){ return item.tag == productType; });
415
415
selectedProductType = selectedFactory->productType ();
416
416
417
+ if (productTypeInRange (selectedProductType))
418
+ {
419
+ mTxtProductDescription .text (ProductCatalogue::get (selectedProductType).Description );
420
+ }
421
+ else
422
+ {
423
+ mTxtProductDescription .text (" " );
424
+ }
425
+
417
426
StructureState state = selectedFactory->state ();
418
427
btnApply.visible (state == StructureState::Operational || state == StructureState::Idle);
419
428
}
@@ -422,7 +431,7 @@ void FactoryReport::onListSelectionChange()
422
431
void FactoryReport::onProductSelectionChange ()
423
432
{
424
433
selectedProductType = static_cast <ProductType>(lstProducts.isItemSelected () ? lstProducts.selected ().tag : 0 );
425
- txtProductDescription .text (ProductCatalogue::get (selectedProductType).Description );
434
+ mTxtProductDescription .text (ProductCatalogue::get (selectedProductType).Description );
426
435
}
427
436
428
437
@@ -485,7 +494,7 @@ void FactoryReport::drawProductPane(Renderer& renderer)
485
494
{
486
495
renderer.drawText (fontBigBold, ProductCatalogue::get (selectedProductType).Name , NAS2D::Point {position_x, detailPanelRect.position .y + 180 }, constants::PrimaryTextColor);
487
496
renderer.drawImage (productImage (selectedProductType), NAS2D::Point {position_x, lstProducts.positionY ()});
488
- txtProductDescription .update ();
497
+ mTxtProductDescription .update ();
489
498
}
490
499
491
500
if (selectedFactory->productType () == ProductType::PRODUCT_NONE) { return ; }
0 commit comments