@@ -165,11 +165,15 @@ public Scalar getBottom() {
165165 return getCorner ().getY ();
166166 }
167167
168- public boolean overlaps (UIElement other , Context context ) {
169- return Condition .lessThan (other .end (RIGHT )).applyTo (end (LEFT )).evaluateIn (context , RIGHT ) &&
170- Condition .lessThan (end (RIGHT )).applyTo (other .end (LEFT )).evaluateIn (context , RIGHT ) &&
171- Condition .lessThan (other .end (DOWN )).applyTo (end (UP )).evaluateIn (context , DOWN ) &&
172- Condition .lessThan (end (DOWN )).applyTo (other .end (UP )).evaluateIn (context , DOWN );
168+ public Expression <Boolean > overlaps (UIElement other ) {
169+ return Expression .and (
170+ Expression .and (
171+ Condition .lessThan (other .end (RIGHT )).applyTo (end (LEFT )),
172+ Condition .lessThan (end (RIGHT )).applyTo (other .end (LEFT ))),
173+ Expression .and (
174+ Condition .lessThan (other .end (DOWN )).applyTo (end (UP )),
175+ Condition .lessThan (end (DOWN )).applyTo (other .end (UP )))
176+ );
173177 }
174178
175179 public boolean notOverlaps (UIElement other , Context context ) {
@@ -346,7 +350,7 @@ public <V extends MetricSpace<V>> void validateSuccessor(ExtendGiving<V> directi
346350
347351
348352 public void validateOverlappingWithElement (UIElement element , Context context ) {
349- if (!overlaps (element , context )) {
353+ if (!overlaps (element ). evaluateIn ( context , DOWN )) {
350354 context .add (String .format ("Element %s is not overlapped with element %s but should be" ,
351355 getQuotedName (),
352356 element .getQuotedName ()));
0 commit comments