Unverified Commit fe0a669c authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

fix sign (#51679)

parent 96003f91
...@@ -859,7 +859,7 @@ class SliverHitTestResult extends HitTestResult { ...@@ -859,7 +859,7 @@ class SliverHitTestResult extends HitTestResult {
assert(crossAxisPosition != null); assert(crossAxisPosition != null);
assert(hitTest != null); assert(hitTest != null);
if (paintOffset != null) { if (paintOffset != null) {
pushTransform(Matrix4.translationValues(paintOffset.dx, paintOffset.dy, 0)); pushTransform(Matrix4.translationValues(-paintOffset.dx, -paintOffset.dy, 0));
} }
final bool isHit = hitTest( final bool isHit = hitTest(
this, this,
......
...@@ -921,6 +921,36 @@ void main() { ...@@ -921,6 +921,36 @@ void main() {
mainAxisPositions.clear(); mainAxisPositions.clear();
crossAxisPositions.clear(); crossAxisPositions.clear();
}); });
test('addWithAxisOffset with non zero paintOffset', () {
final SliverHitTestResult result = SliverHitTestResult();
double recordedMainAxisPosition;
double recordedCrossAxisPosition;
final HitTestEntry entry = HitTestEntry(_DummyHitTestTarget());
const Offset paintOffset = Offset(7, 11);
final bool isHit = result.addWithAxisOffset(
paintOffset: paintOffset,
mainAxisOffset: 5.0,
crossAxisOffset: 6.0,
mainAxisPosition: 10.0,
crossAxisPosition: 20.0,
hitTest: (SliverHitTestResult result, { double mainAxisPosition, double crossAxisPosition }) {
expect(result, isNotNull);
recordedMainAxisPosition = mainAxisPosition;
recordedCrossAxisPosition = crossAxisPosition;
result.add(entry);
return true;
},
);
expect(isHit, isTrue);
expect(recordedMainAxisPosition, 10.0 - 5.0);
expect(recordedCrossAxisPosition, 20.0 - 6.0);
expect(
entry.transform..translate(paintOffset.dx, paintOffset.dy),
Matrix4.identity(),
);
});
}); });
test('SliverConstraints check for NaN on all double properties', () { test('SliverConstraints check for NaN on all double properties', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment