Open BasilioPV opened 8 months ago
Hi,
I do not know if it is related with this issue, but it is worth mentioning that the name text fields of components have a behaviour different from other text fields. The names are shown completely in the diagram of the upper model, whereas other text fields may be hidden or even presented with ellipsis (eg. Dr... instead of Drug).
For example:
and reducing scale:
Other similar example:
and:
In those previous examples the size of the text was selected as (Auto). However, when selecting a fixed size the behaviour does not improve.
Also, text fields move sometimes in a strange way when applying zoom. For example, this is a image of a component instanced on the diagram view of a model:
when reducing zoom:
and reducing more:
(F and R fields are out of the box).
Thanks!
Can you provide a minimal model? It is hard to understand with just images.
Please find this model:
model ii
equation
annotation(
Icon(graphics = {Rectangle(origin = {0, 52}, extent = {{-96, 18}, {96, -18}}), Rectangle(origin = {0, -40}, extent = {{-96, 20}, {96, -20}}), Text(origin = {1, 51}, extent = {{-81, 13}, {81, -13}}, textString = "text"), Text(origin = {0, -42}, extent = {{-86, 14}, {86, -14}}, textString = "text", fontSize = 20)}));
end ii;
Zoom in and out the icon and even the automatic text does not respect the original proportions:
You have reason @adeas31. Excuse me I thought that perhaps it was not necessary in this case. You may use the following minimal model:
package zoomText
model aucClass
Modelica.Blocks.Interfaces.RealOutput so annotation(
Placement(transformation(extent = {{100, -10}, {120, 10}}),
iconTransformation(extent = {{100, -10}, {120, 10}})));
Modelica.Blocks.Interfaces.RealInput si annotation(
Placement(transformation(origin = {-220, 0}, extent = {{100, -10}, {120, 10}}),
iconTransformation(origin = {-220, 0}, extent = {{100, -10}, {120, 10}})));
Modelica.Blocks.Interfaces.BooleanInput bFreeze
annotation(
Placement(transformation(origin = {-60, 60}, extent = {{-10, -10}, {10, 10}}, rotation = -90), iconTransformation(origin = {-60, 60}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Blocks.Interfaces.BooleanInput bReset
annotation(
Placement(transformation(origin = {-60, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 90), iconTransformation(origin = {-60, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
annotation(
Icon(graphics = {Rectangle(lineColor = {0, 0, 255}, extent = {{-70, 50}, {70, -50}}), Line(origin = {81.5842, -0.0683386}, points = {{-12, 0}, {18, 0}}, color = {0, 0, 255}), Line(origin = {-87.6137, -0.109484}, points = {{-14, 0}, {18, 0}}, color = {0, 0, 255}), Rectangle(lineColor = {0, 0, 255}, fillColor = {251, 255, 230}, fillPattern = FillPattern.Solid, extent = {{-70, 50}, {70, -50}}), Text(origin = {-68, -78}, extent = {{32, 62}, {100, 100}}, textString = "sAUC"), Text(origin = {-61, -38}, textColor = {255, 0, 0}, extent = {{-11, 12}, {11, -12}}, textString = "R"), Text(origin = {-59, 40}, textColor = {255, 0, 0}, extent = {{-11, 12}, {11, -12}}, textString = "F"), Text(origin = {34, -54}, extent = {{-150, 150}, {150, 110}}, textString = "%name")}));
end aucClass;
model appClass
annotation(
Icon(graphics = {Rectangle(lineColor = {172, 172, 172}, fillColor = {255, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, 100}, {100, -100}}, radius = 25), Text(origin = {5, -24}, textColor = {0, 85, 127}, extent = {{-55, 32}, {55, -32}}, textString = "Applic", fontName = "Ravie"), Rectangle(origin = {2, 3}, lineThickness = 0.5, extent = {{86, 63}, {-86, -63}}), Rectangle(origin = {-70, 58}, fillColor = {0, 85, 127}, fillPattern = FillPattern.Sphere, lineThickness = 0.5, extent = {{-22, 22}, {22, -22}})}));
end appClass;
model varText
parameter String iUnits = "1" "Input units";
parameter String oUnits = "1" "Output units";
parameter Integer Nout = 2;
parameter Integer Nin = 2;
Modelica.Blocks.Interfaces.RealOutput so[Nout]
annotation(
Placement(transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}),
iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Interfaces.RealInput si[Nin]
annotation(
Placement(transformation(origin = {-220, 0}, extent = {{100, -10}, {120, 10}}),
iconTransformation(origin = {-220, 0}, extent = {{100, -10}, {120, 10}})));
Modelica.Blocks.Interfaces.RealInput sich
annotation(
Placement(transformation(origin = {-220, 0}, extent = {{100, -10}, {120, 10}}),
iconTransformation(origin = {-220, 0}, extent = {{100, -10}, {120, 10}})));
annotation(
Icon(graphics = {Rectangle(lineColor = {0, 0, 255},
extent = {{-70, 50}, {70, -50}}),
Line(origin = {83.976, -0.0622016}, points = {{-14, 0}, {18, 0}},
color = {0, 0, 255}),
Text(origin = {230, -56}, extent = {{-150, 90}, {-12, 74}},
textString = "%Nout", horizontalAlignment = TextAlignment.Left),
Ellipse(origin = {90, -1}, fillColor = {170, 255, 127}, fillPattern = FillPattern.Sphere,
extent = {{-8, 8}, {8, -8}}), Line(origin = {-86.3489, -0.386595},
points = {{-14, 0}, {16, 0}}, color = {0, 0, 255}),
Text(origin = {34, -65}, extent = {{-154, 101}, {-12, 83}}, textString = "%Nin",
horizontalAlignment = TextAlignment.Left),
Text(origin = {32, -52}, extent = {{-150, 150}, {150, 110}}, textString = "%name"),
Rectangle(lineColor = {0, 0, 255}, fillColor = {207, 244, 255},
fillPattern = FillPattern.Solid, extent = {{-70, 50}, {70, -50}}),
Line(origin = {-1.72224, 0}, points = {{-42, 0}, {42, 0}}, color = {255, 0, 0},
arrow = {Arrow.None, Arrow.Filled}, arrowSize = 10),
Line(origin = {-49.0778, 10.651}, points = {{-5, 0}, {5, 0}}, color = {255, 0, 0}),
Line(origin = {-48.9878, 5.33103}, points = {{-5, 0}, {5, 0}}, color = {255, 0, 0}),
Line(origin = {-49.1078, -11.319}, points = {{-5, 0}, {5, 0}}, color = {255, 0, 0}),
Line(origin = {-48.9378, -5.71897}, points = {{-5, 0}, {5, 0}}, color = {255, 0, 0}),
Line(origin = {-49.0178, -0.128967}, points = {{-5, 0}, {5, 0}}, color = {255, 0, 0}),
Line(origin = {-44.0678, -0.358967}, points = {{0, 11}, {0, -11}}, color = {255, 0, 0}),
Text(origin = {-35, 34}, textColor = {255, 0, 0}, extent = {{-27, 30}, {27, -30}},
textString = "%iUnits", fontSize = 16, horizontalAlignment = TextAlignment.Left),
Text(origin = {39, -31}, textColor = {255, 0, 0}, extent = {{-27, 29}, {27, -29}},
textString = "%oUnits", fontSize = 16, horizontalAlignment = TextAlignment.Left)}));
end varText;
model example
aucClass auc1 annotation(
Placement(transformation(origin = {-28, 78}, extent = {{-10, -10}, {10, 10}})));
appClass app1 annotation(
Placement(transformation(origin = {-26, 46}, extent = {{-10, -10}, {10, 10}})));
varText varText1(oUnits = "l/min")
annotation(
Placement(transformation(origin = {-26, 12}, extent = {{-10, -10}, {10, 10}})));
end example;
end zoomText;
I have defined three components with typical problems of text related to zoom. The diagram view of example is a shown:
You see that the name of the three components is ok, and the same occurs with the remaining text,, excepting with the third component that has two text fields associated with String variables. These text fields have been defined with a fixed and equal size, but the result is very coarse.
When I reduce the size through a zoom out:
Although the name of components keep fine, the remaining text are incomplete and some of them (F and R in first component) seem moving to the outside of rectangle.
Thank you for your effort!
Description
Is not possible to keep the text-to-icon proportion when zooming.
Steps to Reproduce
Put a text into a component icon and use it on a system. If you zoom in the component, the text has the proportions (regarding to the icon) as designed:
But when you zoom out, the text size increases and "..." replaces the text that fall outside the box:
Expected Behavior
It would be desirable that the text size increases and decreases in the same proportion of the icon, to have a homogeneous design at all zooms.
Screenshots
Version and OS
Additional Context