diff --git a/src/bin/topola-egui/painter.rs b/src/bin/topola-egui/painter.rs index 5824c8d..ce287fe 100644 --- a/src/bin/topola-egui/painter.rs +++ b/src/bin/topola-egui/painter.rs @@ -16,16 +16,16 @@ impl<'a> Painter<'a> { let epaint_shape = match shape { Shape::Dot(dot) => epaint::Shape::circle_filled( self.transform - .transform_pos([dot.c.pos.x() as f32, dot.c.pos.y() as f32].into()), + .transform_pos([dot.c.pos.x() as f32, -dot.c.pos.y() as f32].into()), dot.c.r as f32 * self.transform.scale().x, color, ), Shape::Seg(seg) => epaint::Shape::line_segment( [ self.transform - .transform_pos([seg.from.x() as f32, seg.from.y() as f32].into()), + .transform_pos([seg.from.x() as f32, -seg.from.y() as f32].into()), self.transform - .transform_pos([seg.to.x() as f32, seg.to.y() as f32].into()), + .transform_pos([seg.to.x() as f32, -seg.to.y() as f32].into()), ], egui::Stroke::new(seg.width as f32 * self.transform.scale().x, color), ), @@ -42,7 +42,7 @@ impl<'a> Painter<'a> { for i in 0..100 { let x = bend.c.pos.x() + bend.c.r * (angle_from + i as f64 * angle_step).cos(); let y = bend.c.pos.y() + bend.c.r * (angle_from + i as f64 * angle_step).sin(); - points.push(self.transform.transform_pos([x as f32, y as f32].into())); + points.push(self.transform.transform_pos([x as f32, -y as f32].into())); } epaint::Shape::line( diff --git a/src/bin/topola-sdl2-demo/painter.rs b/src/bin/topola-sdl2-demo/painter.rs index 274b4c3..4d191e5 100644 --- a/src/bin/topola-sdl2-demo/painter.rs +++ b/src/bin/topola-sdl2-demo/painter.rs @@ -21,7 +21,7 @@ impl<'a> Painter<'a> { Shape::Dot(dot) => { let mut path = Path2D::new(); path.ellipse( - vec2f(dot.c.pos.x() as f32, dot.c.pos.y() as f32), + vec2f(dot.c.pos.x() as f32, -dot.c.pos.y() as f32), dot.c.r as f32, 0.0, 0.0, @@ -31,8 +31,8 @@ impl<'a> Painter<'a> { } Shape::Seg(seg) => { let mut path = Path2D::new(); - path.move_to(vec2f(seg.from.x() as f32, seg.from.y() as f32)); - path.line_to(vec2f(seg.to.x() as f32, seg.to.y() as f32)); + path.move_to(vec2f(seg.from.x() as f32, -seg.from.y() as f32)); + path.line_to(vec2f(seg.to.x() as f32, -seg.to.y() as f32)); self.canvas.set_line_width(seg.width as f32); self.canvas.stroke_path(path); } @@ -45,7 +45,7 @@ impl<'a> Painter<'a> { let mut path = Path2D::new(); path.arc( - vec2f(bend.c.pos.x() as f32, bend.c.pos.y() as f32), + vec2f(bend.c.pos.x() as f32, -bend.c.pos.y() as f32), bend.circle().r as f32, angle1 as f32, angle2 as f32, @@ -58,8 +58,8 @@ impl<'a> Painter<'a> { let envelope = ShapeTrait::envelope(shape, 0.0); // XXX: points represented as arrays can't be conveniently converted to vector types - let topleft = vec2f(envelope.lower()[0] as f32, envelope.lower()[1] as f32); - let bottomright = vec2f(envelope.upper()[0] as f32, envelope.upper()[1] as f32); + let topleft = vec2f(envelope.lower()[0] as f32, -envelope.lower()[1] as f32); + let bottomright = vec2f(envelope.upper()[0] as f32, -envelope.upper()[1] as f32); self.canvas.set_line_width(2.0 / zoom); self.canvas .set_stroke_style(ColorU::new(100, 100, 100, 255)); diff --git a/src/dsn/design.rs b/src/dsn/design.rs index 7573a1e..f27a287 100644 --- a/src/dsn/design.rs +++ b/src/dsn/design.rs @@ -97,7 +97,7 @@ impl DsnDesign { Self::add_circle( &mut layout, (place.x + pin.x) as f64, - -(place.y + pin.y) as f64, + (place.y + pin.y) as f64, circle.diameter as f64 / 2.0, layer as u64, *net_id as i64, @@ -113,9 +113,9 @@ impl DsnDesign { Self::add_rect( &mut layout, (place.x - pin.x + rect.x1) as f64, - -(place.y - pin.y + rect.y1) as f64, + (place.y - pin.y + rect.y1) as f64, (place.x - pin.x + rect.x2) as f64, - -(place.y - pin.y + rect.y2) as f64, + (place.y - pin.y + rect.y2) as f64, layer as u64, *net_id as i64, ) @@ -130,7 +130,7 @@ impl DsnDesign { Self::add_path( &mut layout, (place.x - pin.x) as f64, - -(place.y - pin.y) as f64, + (place.y - pin.y) as f64, &path.coord_vec, path.width as f64, layer as u64, @@ -147,7 +147,7 @@ impl DsnDesign { Self::add_path( &mut layout, (place.x - pin.x) as f64, - -(place.y - pin.y) as f64, + (place.y - pin.y) as f64, &polygon.coord_vec, polygon.width as f64, layer as u64, @@ -184,7 +184,7 @@ impl DsnDesign { Self::add_circle( &mut layout, via.x as f64, - -via.y as f64, + via.y as f64, circle.diameter as f64 / 2.0, layer as u64, net_id as i64, @@ -399,7 +399,7 @@ impl DsnDesign { let mut prev_index = layout .add_fixed_dot(FixedDotWeight { circle: Circle { - pos: (offset_x + coords[0].x as f64, offset_y - coords[0].y as f64).into(), + pos: (offset_x + coords[0].x as f64, offset_y + coords[0].y as f64).into(), r: width / 2.0, }, layer, @@ -412,7 +412,7 @@ impl DsnDesign { let index = layout .add_fixed_dot(FixedDotWeight { circle: Circle { - pos: (offset_x + coord.x as f64, offset_y - coord.y as f64).into(), + pos: (offset_x + coord.x as f64, offset_y + coord.y as f64).into(), r: width / 2.0, }, layer,