Skip to content

Commit 987eb58

Browse files
committed
fix issues with changing the yakui viewport
1 parent 96b6712 commit 987eb58

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

crates/yakui-core/src/input/input_state.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,6 @@ impl InputState {
260260

261261
/// Signal that the mouse has moved.
262262
fn mouse_moved(&self, dom: &Dom, layout: &LayoutDom, pos: Option<Vec2>) {
263-
let pos = pos.map(|pos| pos - layout.unscaled_viewport().pos());
264-
265263
{
266264
let mut mouse = self.mouse.borrow_mut();
267265
mouse.position = pos;

crates/yakui-core/src/layout/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl LayoutDom {
221221
fn resolve_positions(&mut self, dom: &Dom) {
222222
let mut queue = VecDeque::new();
223223

224-
queue.push_back((dom.root(), Vec2::ZERO));
224+
queue.push_back((dom.root(), self.viewport().pos()));
225225

226226
while let Some((id, parent_pos)) = queue.pop_front() {
227227
if let Some(layout_node) = self.nodes.get_mut(id.index()) {

crates/yakui-core/src/paint/paint_dom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ impl PaintDom {
100100
(layout_node.clip.pos() * self.scale_factor).round(),
101101
(layout_node.clip.size() * self.scale_factor).round(),
102102
)
103+
.constrain(layout.unscaled_viewport());
103104

104105
if layout_node.new_layer {
105106
self.layers.push();
@@ -224,7 +225,6 @@ impl PaintDom {
224225

225226
let vertices = mesh.vertices.into_iter().map(|mut vertex| {
226227
let mut pos = vertex.position * self.scale_factor;
227-
pos += self.unscaled_viewport.pos();
228228

229229
// Currently, we only round the vertices of geometry fed to the text
230230
// pipeline because rounding all geometry causes hairline cracks in

0 commit comments

Comments
 (0)