layout/scrolling: Handle move y anim offsets
Browse files at this commit76a901b0efaf517b2fa7e694445a72a173609043Parent: 674105f1 changed file +10 -11
- src/layout/scrolling.rs +10 -11
src/layout/scrolling.rsmodified+10 -11
| @@ -1823,7 +1823,7 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 1823 | .get_or_insert(self.view_offset.stationary() + offset.x); | 1823 | .get_or_insert(self.view_offset.stationary() + offset.x); |
| 1824 | } | 1824 | } |
| 1825 | 1825 | ||
| 1826 | - offset.x += self.columns[source_col_idx].render_offset().x; | 1826 | + offset += self.columns[source_col_idx].render_offset(); |
| 1827 | let RemovedTile { tile, .. } = self.remove_tile_by_idx( | 1827 | let RemovedTile { tile, .. } = self.remove_tile_by_idx( |
| 1828 | source_col_idx, | 1828 | source_col_idx, |
| 1829 | 0, | 1829 | 0, |
| @@ -1833,14 +1833,14 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 1833 | self.add_tile_to_column(target_column_idx, None, tile, source_tile_was_active); | 1833 | self.add_tile_to_column(target_column_idx, None, tile, source_tile_was_active); |
| 1834 | 1834 | ||
| 1835 | let target_column = &mut self.columns[target_column_idx]; | 1835 | let target_column = &mut self.columns[target_column_idx]; |
| 1836 | - offset.x -= target_column.render_offset().x; | 1836 | + offset -= target_column.render_offset(); |
| 1837 | offset += prev_off - target_column.tile_offset(target_column.tiles.len() - 1); | 1837 | offset += prev_off - target_column.tile_offset(target_column.tiles.len() - 1); |
| 1838 | 1838 | ||
| 1839 | let new_tile = target_column.tiles.last_mut().unwrap(); | 1839 | let new_tile = target_column.tiles.last_mut().unwrap(); |
| 1840 | new_tile.animate_move_from(offset); | 1840 | new_tile.animate_move_from(offset); |
| 1841 | } else { | 1841 | } else { |
| 1842 | // Move out of column. | 1842 | // Move out of column. |
| 1843 | - let mut offset = Point::from((source_column.render_offset().x, 0.)); | 1843 | + let mut offset = source_column.render_offset(); |
| 1844 | 1844 | ||
| 1845 | let removed = | 1845 | let removed = |
| 1846 | self.remove_tile_by_idx(source_col_idx, source_tile_idx, Transaction::new(), None); | 1846 | self.remove_tile_by_idx(source_col_idx, source_tile_idx, Transaction::new(), None); |
| @@ -1898,7 +1898,7 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 1898 | let cur_x = self.column_x(source_col_idx); | 1898 | let cur_x = self.column_x(source_col_idx); |
| 1899 | 1899 | ||
| 1900 | let source_column = &self.columns[source_col_idx]; | 1900 | let source_column = &self.columns[source_col_idx]; |
| 1901 | - let mut offset = Point::from((source_column.render_offset().x, 0.)); | 1901 | + let mut offset = source_column.render_offset(); |
| 1902 | let prev_off = source_column.tile_offset(source_tile_idx); | 1902 | let prev_off = source_column.tile_offset(source_tile_idx); |
| 1903 | 1903 | ||
| 1904 | let source_tile_was_active = self.active_column_idx == source_col_idx | 1904 | let source_tile_was_active = self.active_column_idx == source_col_idx |
| @@ -1913,7 +1913,7 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 1913 | let target_column_idx = source_col_idx; | 1913 | let target_column_idx = source_col_idx; |
| 1914 | 1914 | ||
| 1915 | offset.x += cur_x - self.column_x(source_col_idx + 1); | 1915 | offset.x += cur_x - self.column_x(source_col_idx + 1); |
| 1916 | - offset.x -= self.columns[source_col_idx + 1].render_offset().x; | 1916 | + offset -= self.columns[source_col_idx + 1].render_offset(); |
| 1917 | 1917 | ||
| 1918 | if source_tile_was_active { | 1918 | if source_tile_was_active { |
| 1919 | // Make sure the target column gets activated. | 1919 | // Make sure the target column gets activated. |
| @@ -1977,10 +1977,9 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 1977 | let target_column_idx = self.active_column_idx; | 1977 | let target_column_idx = self.active_column_idx; |
| 1978 | let source_column_idx = self.active_column_idx + 1; | 1978 | let source_column_idx = self.active_column_idx + 1; |
| 1979 | 1979 | ||
| 1980 | - let offset = self.column_x(source_column_idx) | 1980 | + let mut offset = self.columns[source_column_idx].render_offset(); |
| 1981 | - + self.columns[source_column_idx].render_offset().x | 1981 | + offset.x += self.column_x(source_column_idx); |
| 1982 | - - self.column_x(target_column_idx); | 1982 | + offset.x -= self.column_x(target_column_idx); |
| 1983 | - let mut offset = Point::from((offset, 0.)); | ||
| 1984 | let prev_off = self.columns[source_column_idx].tile_offset(0); | 1983 | let prev_off = self.columns[source_column_idx].tile_offset(0); |
| 1985 | 1984 | ||
| 1986 | let removed = self.remove_tile_by_idx(source_column_idx, 0, Transaction::new(), None); | 1985 | let removed = self.remove_tile_by_idx(source_column_idx, 0, Transaction::new(), None); |
| @@ -1988,7 +1987,7 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 1988 | 1987 | ||
| 1989 | let target_column = &mut self.columns[target_column_idx]; | 1988 | let target_column = &mut self.columns[target_column_idx]; |
| 1990 | offset += prev_off - target_column.tile_offset(target_column.tiles.len() - 1); | 1989 | offset += prev_off - target_column.tile_offset(target_column.tiles.len() - 1); |
| 1991 | - offset.x -= target_column.render_offset().x; | 1990 | + offset -= target_column.render_offset(); |
| 1992 | 1991 | ||
| 1993 | let new_tile = target_column.tiles.last_mut().unwrap(); | 1992 | let new_tile = target_column.tiles.last_mut().unwrap(); |
| 1994 | new_tile.animate_move_from(offset); | 1993 | new_tile.animate_move_from(offset); |
| @@ -2010,7 +2009,7 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 2010 | 2009 | ||
| 2011 | let source_tile_idx = source_column.tiles.len() - 1; | 2010 | let source_tile_idx = source_column.tiles.len() - 1; |
| 2012 | 2011 | ||
| 2013 | - let mut offset = Point::from((source_column.render_offset().x, 0.)); | 2012 | + let mut offset = source_column.render_offset(); |
| 2014 | let prev_off = source_column.tile_offset(source_tile_idx); | 2013 | let prev_off = source_column.tile_offset(source_tile_idx); |
| 2015 | 2014 | ||
| 2016 | let removed = | 2015 | let removed = |