Esempio n. 1
0
def test_projection_updates_when_matrix_is_changed(solver):
    pos = Position(0, 0)
    matrix = Matrix()
    proj = MatrixProjection(pos, matrix)
    solver.add_constraint(proj)
    solver.solve()

    matrix.translate(2, 3)
    solver.solve()

    assert proj.x == 2
    assert proj.y == 3
Esempio n. 2
0
    def on_adjustment_changed(self, adj):
        """Change the transformation matrix of the view to reflect the value of
        the x/y adjustment (scrollbar)."""
        value = adj.get_value()
        if value == 0.0:
            return

        m = Matrix()
        if adj is self.hadjustment:
            m.translate(self._last_hvalue - value, 0)
            self._last_hvalue = value
        elif adj is self.vadjustment:
            m.translate(0, self._last_vvalue - value)
            self._last_vvalue = value

        self._scrolling_updated(m)