* A pseudo-component containing all submodel interface pins on the submodel side.
*/
private final SubmodelInterface submodelInterface;
-
/**
* The factor by which the submodel is scaled when rendering.
*/
private double submodelScale;
- /**
- * If this {@link SubmodelComponent} fills at least this amount of the visible region vertically or horizontally, the submodel starts to
- * be visible.
- */
- private double maxVisibleRegionFillRatioForAlpha0;
- /**
- * If this {@link SubmodelComponent} fills at least this amount of the visible region vertically or horizontally, the submodel is fully
- * visible.
- */
- private double minVisibleRegionFillRatioForAlpha1;
/**
* The renderer used for rendering the submodel.
*/
private final LogicUIRenderer renderer;
-
/**
* The {@link Renderer} used to render the symbol of this SubmodelCoponent.
*/
this.submodelInterface = new SubmodelInterface(submodelModifiable);
this.submodelScale = 1;
- this.maxVisibleRegionFillRatioForAlpha0 = 0.8;
- this.minVisibleRegionFillRatioForAlpha1 = 0.9;
this.renderer = new LogicUIRenderer(submodelModifiable);
Consumer<Runnable> redrawHandlerChangedListener = submodelModifiable::setRedrawHandler;
GCConfig conf = new GCConfig(gc);
GeneralGC tgc = new TranslatedGC(gc, getPosX(), getPosY(), submodelScale, true);
conf.reset(tgc);
- double visibleRegionFillRatio = Math.max(getWidth() / visibleRegion.width, getHeight() / visibleRegion.height);
+ double visibleRegionFillRatio = getWidth() * getHeight() / (visibleRegion.width * visibleRegion.height);
+ /**
+ * If this {@link SubmodelComponent} fills at least this amount of the visible region vertically or horizontally, the submodel
+ * starts to be visible.
+ */
+ double maxVisibleRegionFillRatioForAlpha0 = Preferences.current().getDouble("net.mograsim.logic.model.submodel.zoomalpha0");
+ /**
+ * If this {@link SubmodelComponent} fills at least this amount of the visible region vertically or horizontally, the submodel is
+ * fully visible.
+ */
+ double minVisibleRegionFillRatioForAlpha1 = Preferences.current().getDouble("net.mograsim.logic.model.submodel.zoomalpha1");
double alphaFactor = map(visibleRegionFillRatio, maxVisibleRegionFillRatioForAlpha0, minVisibleRegionFillRatioForAlpha1, 0, 1);
alphaFactor = Math.max(0, Math.min(1, alphaFactor));
// we need to take the old alpha into account to support nested submodules better.
*
* @author Daniel Kirschten
*/
- protected void renderSymbol(GeneralGC gc, Rectangle visibleRegion)
+ private void renderSymbol(GeneralGC gc, Rectangle visibleRegion)
{
if (symbolRenderer != null)
symbolRenderer.render(gc, visibleRegion);
*
* @author Daniel Kirschten
*/
- protected void renderOutline(GeneralGC gc, Rectangle visibleRegion)
+ private void renderOutline(GeneralGC gc, Rectangle visibleRegion)
{
if (outlineRenderer != null)
outlineRenderer.render(gc, visibleRegion);