@@ -1293,11 +1293,11 @@ def _set(self, child):
1293
1293
self .transform_path_non_affine = child .transform_path_non_affine
1294
1294
self .get_affine = child .get_affine
1295
1295
self .inverted = child .inverted
1296
- self .is_affine = child .is_affine
1297
1296
self .get_matrix = child .get_matrix
1298
1297
1299
- def __eq__ (self , other ):
1300
- return self ._child == other
1298
+ # note we do not wrap other properties here since the transform's
1299
+ # child can be changed with WrappedTransform.set and so checking
1300
+ # is_affine and other such properties may be dangerous.
1301
1301
1302
1302
def set (self , child ):
1303
1303
"""
@@ -2044,9 +2044,13 @@ def composite_transform_factory(a, b):
2044
2044
2045
2045
c = a + b
2046
2046
"""
2047
- if a == IdentityTransform ():
2047
+ # check to see if any of a or b are IdentityTransforms. Note we
2048
+ # do not use equality here since we may have wrapped transforms
2049
+ # which are currently equal to Identity, but since wrapped transforms
2050
+ # are mutable, they may not always be equal.
2051
+ if isinstance (a , IdentityTransform ):
2048
2052
return b
2049
- elif b == IdentityTransform ( ):
2053
+ elif isinstance ( b , IdentityTransform ):
2050
2054
return a
2051
2055
elif a .is_affine and b .is_affine :
2052
2056
return CompositeAffine2D (a , b )
0 commit comments