Browse Source

UI: Fixed incorrect work animation and fixed fill size in liquid level

pull/9456/head
Vladyslav_Prykhodko 3 years ago
parent
commit
5d8596ae63
  1. 31
      ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.component.ts
  2. 6
      ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.models.ts
  3. 2
      ui-ngx/src/assets/widget/liquid-level/shapes/horizontal-cylinder.svg
  4. 2
      ui-ngx/src/assets/widget/liquid-level/shapes/horizontal-ellipse.svg
  5. 2
      ui-ngx/src/assets/widget/liquid-level/shapes/horizontal-oval.svg
  6. 2
      ui-ngx/src/assets/widget/liquid-level/shapes/vertical-oval.svg

31
ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.component.ts

@ -331,7 +331,7 @@ export class LiquidLevelWidgetComponent implements OnInit {
}
private calculatePosition(percentage: number, limits: SvgLimits): number {
if (percentage > 100) {
if (percentage >= 100) {
return limits.max;
} if (percentage <= 0) {
return limits.min;
@ -355,25 +355,16 @@ export class LiquidLevelWidgetComponent implements OnInit {
const surfacePositionAttr = this.shape !== Shapes.vCylinder ? 'y' : 'cy';
const animationSpeed = 500;
if (percentage > 1) {
fill.css('visibility', 'visible');
fill.animate({y : newY}, animationSpeed);
fill.attr('fill', this.liquidColor.color);
surfaces.each((index, element) => {
const $element = $(element);
$element.css('visibility', 'visible');
$element.animate({[surfacePositionAttr]: newY}, animationSpeed);
if ($element.hasClass('tb-liquid')) {
$element.attr('fill', this.liquidColor.color);
}
});
} else {
fill.css('visibility', 'hidden').stop().clearQueue();
surfaces.each((index, element) => {
$(element).css('visibility', 'hidden').stop().clearQueue();
});
}
fill.animate({y : newY}, animationSpeed);
fill.attr('fill', this.liquidColor.color);
surfaces.each((index, element) => {
const $element = $(element);
$element.animate({[surfacePositionAttr]: newY}, animationSpeed);
if ($element.hasClass('tb-liquid')) {
$element.attr('fill', this.liquidColor.color);
}
});
}
private updateShapeColor(value: number): void {

6
ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.models.ts

@ -131,7 +131,7 @@ export const svgMapping = new Map<Shapes, SvgInfo>(
Shapes.vOval,
{
svg: 'assets/widget/liquid-level/shapes/vertical-oval.svg',
limits: { min: 170, max: 50 }
limits: { min: 170, max: 51 }
}
],
[
@ -166,7 +166,7 @@ export const svgMapping = new Map<Shapes, SvgInfo>(
Shapes.hEllipse,
{
svg: 'assets/widget/liquid-level/shapes/horizontal-ellipse.svg',
limits: { min: 160, max: 65 }
limits: { min: 160, max: 64 }
}
],
[
@ -180,7 +180,7 @@ export const svgMapping = new Map<Shapes, SvgInfo>(
Shapes.hCylinder,
{
svg: 'assets/widget/liquid-level/shapes/horizontal-cylinder.svg',
limits: { min: 165, max: 55 }
limits: { min: 165, max: 56 }
}
],
[

2
ui-ngx/src/assets/widget/liquid-level/shapes/horizontal-cylinder.svg

@ -8,7 +8,7 @@
<path class="tb-shape-fill" d="M54.5281 56.5L54.5259 58.5H54.5281V56.5ZM54.4719 56.5V58.5L54.4741 58.5L54.4719 56.5ZM53.5 56.5V54.5L51.5 54.5V56.5H53.5ZM53.5 56.5193L53.5774 58.5178L55.5 58.4434V56.5193H53.5ZM53.5 164.481H55.5V162.557L53.5774 162.482L53.5 164.481ZM53.5 164.5H51.5V166.5L53.5 166.5L53.5 164.5ZM54.5 164.5V162.5H54.5L54.5 164.5ZM178.486 164.5V166.5V164.5ZM179.5 164.5V166.5H181.502L181.5 164.498L179.5 164.5ZM179.5 164.481L179.423 162.482L177.498 162.557L177.5 164.482L179.5 164.481ZM179.5 56.5194H177.5V58.4434L179.423 58.5179L179.5 56.5194ZM179.5 56.5H181.5V54.5L179.5 54.5V56.5ZM178.5 56.5V54.5V56.5ZM54.5 58.5C54.5086 58.5 54.5173 58.5 54.5259 58.5L54.5302 54.5C54.5202 54.5 54.5101 54.5 54.5 54.5V58.5ZM54.4741 58.5C54.4827 58.5 54.4914 58.5 54.5 58.5V54.5C54.4899 54.5 54.4798 54.5 54.4698 54.5L54.4741 58.5ZM54.4719 54.5H53.5V58.5H54.4719V54.5ZM51.5 56.5V56.5193H55.5V56.5H51.5ZM19.5 110.5C19.5 96.1785 23.4156 83.274 29.6733 73.9102C35.9388 64.5346 44.4175 58.8726 53.5774 58.5178L53.4226 54.5208C42.6102 54.9395 33.0889 61.6001 26.3475 71.6877C19.5983 81.787 15.5 95.4862 15.5 110.5H19.5ZM53.5774 162.482C44.4175 162.127 35.9388 156.465 29.6733 147.09C23.4156 137.726 19.5 124.822 19.5 110.5H15.5C15.5 125.514 19.5983 139.213 26.3475 149.312C33.0889 159.4 42.6102 166.06 53.4226 166.479L53.5774 162.482ZM51.5 164.481V164.5H55.5V164.481H51.5ZM53.5 166.5L54.5 166.5L54.5 162.5L53.5 162.5L53.5 166.5ZM54.5 166.5L178.486 166.5V162.5L54.5 162.5V166.5ZM178.486 166.5H178.5V162.5H178.486V166.5ZM178.5 166.5H178.514V162.5H178.5V166.5ZM178.514 166.5H179.5V162.5H178.514V166.5ZM181.5 164.498L181.5 164.479L177.5 164.482L177.5 164.502L181.5 164.498ZM179.577 166.479C190.39 166.06 199.911 159.4 206.652 149.312C213.402 139.213 217.5 125.514 217.5 110.5H213.5C213.5 124.822 209.584 137.726 203.327 147.09C197.061 156.465 188.582 162.127 179.423 162.482L179.577 166.479ZM217.5 110.5C217.5 95.4862 213.402 81.787 206.652 71.6877C199.911 61.6001 190.39 54.9396 179.577 54.5208L179.423 58.5179C188.582 58.8726 197.061 64.5346 203.327 73.9102C209.584 83.274 213.5 96.1785 213.5 110.5H217.5ZM181.5 56.5194V56.5H177.5V56.5194H181.5ZM179.5 54.5H178.5V58.5H179.5V54.5ZM178.5 54.5L54.5281 54.5V58.5L178.5 58.5V54.5Z" fill="#242770" mask="url(#path-2-inside-1_3572_4876)"/>
</mask>
<g mask="url(#mask0_3572_4876)">
<rect class="tb-liquid-fill tb-liquid" x="17.5" y="118.5" width="198" height="108" fill="#7A8BFF"/>
<rect class="tb-liquid-fill tb-liquid" x="17.5" y="118.5" width="198" height="110" fill="#7A8BFF"/>
<rect class="tb-liquid-surface tb-liquid" x="17.5" y="118.5" width="198" height="1" fill="#7A8BFF"/>
<rect class="tb-liquid-surface" x="17.5" y="118.5" width="198" height="1" fill="white" fill-opacity="0.1"/>
</g>

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

2
ui-ngx/src/assets/widget/liquid-level/shapes/horizontal-ellipse.svg

@ -9,7 +9,7 @@
<path class="tb-shape-fill" d="M71.5 64.5V62.5L69.5 62.5V64.5H71.5ZM71.5 64.8349L71.6495 66.8293L73.5 66.6906V64.8349H71.5ZM80.4756 64.5V66.5H80.476L80.4756 64.5ZM80.5244 64.5L80.524 66.5H80.5244V64.5ZM152.5 64.5V66.5V64.5ZM162.5 64.5H164.5V62.5H162.5V64.5ZM162.5 64.9141H160.5V66.7541L162.334 66.9072L162.5 64.9141ZM162.5 158.086L162.334 156.093L160.5 156.246L160.5 158.086L162.5 158.086ZM162.5 158.5V160.5L164.5 160.5L164.5 158.5L162.5 158.5ZM152.5 158.5V160.5V158.5ZM71.5 158.5H69.5V160.5H71.5V158.5ZM71.5 158.165H73.5V156.309L71.6495 156.171L71.5 158.165ZM69.5 64.5V64.8349H73.5V64.5H69.5ZM80.4756 62.5L71.5 62.5V66.5L80.4756 66.5V62.5ZM80.476 66.5C80.484 66.5 80.492 66.5 80.5 66.5V62.5C80.4917 62.5 80.4835 62.5 80.4752 62.5L80.476 66.5ZM80.5 66.5C80.508 66.5 80.516 66.5 80.524 66.5L80.5248 62.5C80.5165 62.5 80.5083 62.5 80.5 62.5V66.5ZM152.5 62.5L80.5244 62.5V66.5L152.5 66.5V62.5ZM162.5 62.5L152.5 62.5V66.5L162.5 66.5V62.5ZM164.5 64.9141V64.5H160.5V64.9141H164.5ZM229.5 111.5C229.5 98.7275 221.913 87.3081 209.918 78.7882C197.912 70.2601 181.303 64.4771 162.666 62.9211L162.334 66.9072C180.391 68.4149 196.282 74.0085 207.602 82.0493C218.934 90.0982 225.5 100.44 225.5 111.5H229.5ZM162.666 160.079C181.303 158.523 197.912 152.74 209.918 144.212C221.913 135.692 229.5 124.272 229.5 111.5H225.5C225.5 122.56 218.934 132.902 207.602 140.951C196.282 148.992 180.391 154.585 162.334 156.093L162.666 160.079ZM164.5 158.5L164.5 158.086L160.5 158.086L160.5 158.5L164.5 158.5ZM152.5 160.5L162.5 160.5V156.5L152.5 156.5V160.5ZM80.5 160.5H152.5V156.5H80.5V160.5ZM71.5 160.5H80.5V156.5H71.5V160.5ZM69.5 158.165V158.5H73.5V158.165H69.5ZM71.6495 156.171C53.3524 154.799 37.2139 149.238 25.7066 141.168C14.1863 133.09 7.5 122.66 7.5 111.5H3.5C3.5 124.389 11.2247 135.898 23.4099 144.443C35.608 152.998 52.4696 158.744 71.3505 160.159L71.6495 156.171ZM7.5 111.5C7.5 100.34 14.1863 89.9103 25.7065 81.8316C37.2139 73.7618 53.3524 68.2006 71.6495 66.8293L71.3505 62.8405C52.4696 64.2555 35.608 70.0025 23.4099 78.5566C11.2247 87.1017 3.5 98.6114 3.5 111.5H7.5Z" fill="#242770" mask="url(#path-2-inside-1_3572_6212)"/>
</mask>
<g mask="url(#mask0_3572_6212)">
<rect class="tb-liquid-fill tb-liquid" x="4.5" y="118.5" width="224" height="94" fill="#7A8BFF"/>
<rect class="tb-liquid-fill tb-liquid" x="4.5" y="118.5" width="224" height="100" fill="#7A8BFF"/>
<rect class="tb-liquid-surface tb-liquid" x="4.5" y="118.5" width="224" height="1" fill="#7A8BFF"/>
<rect class="tb-liquid-surface" x="4.5" y="118.5" width="224" height="1" fill="white" fill-opacity="0.1"/>
</g>

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

2
ui-ngx/src/assets/widget/liquid-level/shapes/horizontal-oval.svg

@ -9,7 +9,7 @@
<path class="tb-shape-fill" d="M49.5 63.5418L49.5837 65.54L51.5 65.4598V63.5418H49.5ZM49.5 157.458H51.5V155.54L49.5837 155.46L49.5 157.458ZM49.5 157.5H47.5V159.5H49.5V157.5ZM180.5 157.5V159.5H180.5L180.5 157.5ZM181.5 157.5V155.5H181.5L181.5 157.5ZM181.5 63.5V61.5V63.5ZM145.5 63.5V61.5L145.499 61.5L145.5 63.5ZM145.428 63.5001V65.5001L145.43 65.5001L145.428 63.5001ZM92.5754 63.5001L92.5722 65.5001H92.5754V63.5001ZM51.4235 63.5001V65.5001L51.4267 65.5001L51.4235 63.5001ZM49.5 63.5001V61.5001L47.5 61.5001V63.5001H49.5ZM6.5 110.5C6.5 86.2892 25.6205 66.5432 49.5837 65.54L49.4163 61.5435C23.3201 62.636 2.5 84.1361 2.5 110.5H6.5ZM49.5837 155.46C25.6205 154.457 6.5 134.711 6.5 110.5H2.5C2.5 136.864 23.3201 158.364 49.4164 159.456L49.5837 155.46ZM47.5 157.458V157.5H51.5V157.458H47.5ZM49.5 159.5L180.5 159.5V155.5L49.5 155.5V159.5ZM180.5 159.5L181.5 159.5L181.5 155.5L180.5 155.5L180.5 159.5ZM181.5 159.5C208.562 159.5 230.5 137.562 230.5 110.5H226.5C226.5 135.353 206.353 155.5 181.5 155.5V159.5ZM230.5 110.5C230.5 83.4381 208.562 61.5 181.5 61.5V65.5C206.353 65.5 226.5 85.6472 226.5 110.5H230.5ZM181.5 61.5L145.5 61.5V65.5L181.5 65.5V61.5ZM145.499 61.5L145.427 61.5001L145.43 65.5001L145.501 65.5L145.499 61.5ZM145.428 61.5001L92.5754 61.5001V65.5001L145.428 65.5001V61.5001ZM92.5 65.5C92.5241 65.5 92.5482 65.5 92.5722 65.5001L92.5785 61.5001C92.5523 61.5 92.5262 61.5 92.5 61.5V65.5ZM51.5 65.5H92.5V61.5H51.5V65.5ZM51.4267 65.5001C51.4511 65.5 51.4756 65.5 51.5 65.5V61.5C51.4734 61.5 51.4469 61.5 51.4203 61.5001L51.4267 65.5001ZM51.4235 61.5001L49.5 61.5001V65.5001H51.4235V61.5001ZM47.5 63.5001V63.5418H51.5V63.5001H47.5Z" fill="#242770" mask="url(#path-2-inside-1_3572_10610)"/>
</mask>
<g mask="url(#mask0_3572_10610)">
<rect class="tb-liquid-fill tb-liquid" x="4.5" y="118.5" width="224" height="94" fill="#7A8BFF"/>
<rect class="tb-liquid-fill tb-liquid" x="4.5" y="118.5" width="224" height="100" fill="#7A8BFF"/>
<rect class="tb-liquid-surface tb-liquid" x="4.5" y="118.5" width="224" height="1" fill="#7A8BFF"/>
<rect class="tb-liquid-surface" x="4.5" y="118.5" width="224" height="1" fill="white" fill-opacity="0.1"/>
</g>

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

2
ui-ngx/src/assets/widget/liquid-level/shapes/vertical-oval.svg

@ -8,7 +8,7 @@
<path class="tb-shape-fill" d="M53.5 51.5133L53.553 53.5125L55.5 53.4609V51.5133H53.5ZM53.5 170.487H55.5V168.539L53.553 168.487L53.5 170.487ZM53.5 170.5H51.5V172.5H53.5V170.5ZM179.462 170.5L179.463 168.5H179.462V170.5ZM179.5 170.5L179.499 172.5H179.5V170.5ZM179.5 51.5V49.5V51.5ZM54.5239 51.5L54.5227 53.5H54.5239V51.5ZM54.4761 51.5V53.5L54.4773 53.5L54.4761 51.5ZM53.5 51.5V49.5L51.5 49.5V51.5H53.5ZM19.5 88.5C19.5 69.4867 34.6614 54.0138 53.553 53.5125L53.4469 49.514C32.3941 50.0726 15.5 67.313 15.5 88.5H19.5ZM19.5 133.5V88.5H15.5V133.5H19.5ZM53.553 168.487C34.6614 167.986 19.5 152.513 19.5 133.5H15.5C15.5 154.687 32.3941 171.927 53.447 172.486L53.553 168.487ZM51.5 170.487V170.5H55.5V170.487H51.5ZM53.5 172.5H54.476V168.5H53.5V172.5ZM54.5 168.5C54.4966 168.5 54.493 168.5 54.4889 168.5C54.485 168.5 54.4805 168.5 54.476 168.5V172.5C54.4794 172.5 54.483 172.5 54.487 172.5C54.491 172.5 54.4954 172.5 54.5 172.5V168.5ZM54.524 168.5C54.5195 168.5 54.515 168.5 54.5111 168.5C54.507 168.5 54.5034 168.5 54.5 168.5V172.5C54.5046 172.5 54.509 172.5 54.513 172.5C54.517 172.5 54.5206 172.5 54.524 172.5V168.5ZM54.524 172.5H179.462V168.5H54.524V172.5ZM179.461 172.5L179.499 172.5L179.501 168.5L179.463 168.5L179.461 172.5ZM179.5 172.5C201.039 172.5 218.5 155.039 218.5 133.5H214.5C214.5 152.83 198.83 168.5 179.5 168.5V172.5ZM218.5 133.5V88.5H214.5V133.5H218.5ZM218.5 88.5C218.5 66.9609 201.039 49.5 179.5 49.5V53.5C198.83 53.5 214.5 69.17 214.5 88.5H218.5ZM179.5 49.5L54.5239 49.5V53.5L179.5 53.5V49.5ZM54.5 53.5C54.5075 53.5 54.5151 53.5 54.5227 53.5L54.5252 49.5C54.5168 49.5 54.5084 49.5 54.5 49.5V53.5ZM54.4773 53.5C54.4849 53.5 54.4924 53.5 54.5 53.5V49.5C54.4916 49.5 54.4832 49.5 54.4748 49.5L54.4773 53.5ZM54.4761 49.5H53.5V53.5H54.4761V49.5ZM51.5 51.5V51.5133H55.5V51.5H51.5Z" fill="#242770" mask="url(#path-2-inside-1_3572_10305)"/>
</mask>
<g mask="url(#mask0_3572_10305)">
<rect class="tb-liquid-fill tb-liquid" x="17.5" y="118.5" width="199" height="119" fill="#7A8BFF"/>
<rect class="tb-liquid-fill tb-liquid" x="17.5" y="118.5" width="199" height="120" fill="#7A8BFF"/>
<rect class="tb-liquid-surface tb-liquid" x="17.5" y="118.5" width="199" height="1" fill="#7A8BFF"/>
<rect class="tb-liquid-surface" x="17.5" y="118.5" width="199" height="1" fill="white" fill-opacity="0.1"/>
</g>

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Loading…
Cancel
Save