def scale_xy(self, scale_x, scale_y, caller=None): """ Scales the event to be in the scale specified. A component calls event.scale_xy(scale) to scale the event into its own coordinate frame when the ctm has been scaled. This operation is used for zooming. """ # Note that the meaning of scale_x and scale_y for Enable # is the inverted from the meaning for Kiva.affine. # TODO: Fix this discrepancy. self.push_transform(affine.affine_from_scale(1/scale_x, 1/scale_y)) if caller is not None: self.dispatch_history.append(caller) return
def scale_xy(self, scale_x, scale_y, caller=None): """ Scales the event to be in the scale specified. A component calls event.scale_xy(scale) to scale the event into its own coordinate frame when the ctm has been scaled. This operation is used for zooming. """ # Note that the meaning of scale_x and scale_y for Enable # is the inverted from the meaning for Kiva.affine. # TODO: Fix this discrepancy. self.push_transform(affine.affine_from_scale(1 / scale_x, 1 / scale_y)) if caller is not None: self.dispatch_history.append(caller) return
def test_from_scale(self): transform = affine.affine_from_scale(5., 6.) pt1 = array([1., 1., 1.]) actual = dot(pt1, transform) desired = pt1 * array((5., 6., 1.)) assert (alltrue(actual == desired))
def test_from_scale(self): transform = affine.affine_from_scale(5.,6.) pt1 = array([1.,1.,1.]) actual = dot(pt1,transform) desired = pt1*array((5.,6.,1.)) assert(alltrue( actual == desired ))
def test_from_scale(self): transform = affine.affine_from_scale(5.0, 6.0) pt1 = array([1.0, 1.0, 1.0]) actual = dot(pt1, transform) desired = pt1 * array((5.0, 6.0, 1.0)) assert alltrue(actual == desired)