Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e1ab408

Browse files
author
nturgut
committed
using reviewer suggestion for translations
1 parent 879913f commit e1ab408

File tree

2 files changed

+13
-32
lines changed

2 files changed

+13
-32
lines changed

lib/web_ui/lib/src/engine/semantics/semantics.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -852,12 +852,12 @@ class SemanticsObject {
852852
verticalContainerAdjustment == 0.0 &&
853853
horizontalContainerAdjustment == 0.0) {
854854
element.style
855-
..removeProperty('transform-origin')
856-
..removeProperty('transform');
855+
..removeProperty('top')
856+
..removeProperty('left');
857857
if (containerElement != null) {
858858
containerElement.style
859-
..removeProperty('transform-origin')
860-
..removeProperty('transform');
859+
..removeProperty('top')
860+
..removeProperty('left');
861861
}
862862
return;
863863
}
@@ -882,15 +882,14 @@ class SemanticsObject {
882882
}
883883

884884
if (!effectiveTransformIsIdentity) {
885-
final Position2D position2d =
886-
matrix4ToCssTransformForSemantics(effectiveTransform);
885+
final Vector3 translation = effectiveTransform.getTranslation();
887886
element.style
888-
..top = position2d.top
889-
..left = position2d.left;
887+
..top = '${translation.y}px'
888+
..left = '${translation.x}px';
890889
} else {
891890
element.style
892-
..removeProperty('transform-origin')
893-
..removeProperty('transform');
891+
..removeProperty('top')
892+
..removeProperty('left');
894893
}
895894

896895
if (containerElement != null) {
@@ -900,12 +899,12 @@ class SemanticsObject {
900899
final double translateX = -_rect!.left + horizontalContainerAdjustment;
901900
final double translateY = -_rect!.top + verticalContainerAdjustment;
902901
containerElement.style
903-
..transformOrigin = '0 0 0'
904-
..transform = 'translate(${translateX}px, ${translateY}px)';
902+
..top = '${translateY}px'
903+
..left = '${translateX}px';
905904
} else {
906905
containerElement.style
907-
..removeProperty('transform-origin')
908-
..removeProperty('transform');
906+
..removeProperty('top')
907+
..removeProperty('left');
909908
}
910909
}
911910
}

lib/web_ui/lib/src/engine/util.dart

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ String matrix4ToCssTransform(Matrix4 matrix) {
5555
return float64ListToCssTransform(matrix.storage);
5656
}
5757

58-
/// Converts [matrix] to CSS top/left values.
59-
Position2D matrix4ToCssTransformForSemantics(Matrix4 matrix) {
60-
return float64ListToCss2dPositionSemantics(matrix.storage);
61-
}
62-
6358
/// Applies a transform to the [element].
6459
///
6560
/// See [float64ListToCssTransform] for details on how the CSS value is chosen.
@@ -91,19 +86,6 @@ String float64ListToCssTransform(Float32List matrix) {
9186
}
9287
}
9388

94-
/// Converts [matrix] to coordinates on 2 dimensional space.
95-
///
96-
/// Only used by semantics node styling calculations, since semantics
97-
/// node does not receive 3D transforms, only tx and ty values of the matrix
98-
/// is used.
99-
Position2D float64ListToCss2dPositionSemantics(Float32List matrix) {
100-
assert(transformKindOf(matrix) != TransformKind.transform2d);
101-
assert(matrix.length == 16);
102-
final Float32List m = matrix;
103-
print('top left: ${matrix[13]} ${matrix[12]} semantics');
104-
return Position2D('${matrix[13]}px', '${matrix[12]}px');
105-
}
106-
10789
/// The kind of effect a transform matrix performs.
10890
enum TransformKind {
10991
/// No effect.

0 commit comments

Comments
 (0)