mirror of https://codeberg.org/topola/topola.git
dsn: don't flip y coord on import, do so when rendering
This commit is contained in:
parent
cc7b3ac875
commit
d58bff85fe
|
|
@ -16,16 +16,16 @@ impl<'a> Painter<'a> {
|
||||||
let epaint_shape = match shape {
|
let epaint_shape = match shape {
|
||||||
Shape::Dot(dot) => epaint::Shape::circle_filled(
|
Shape::Dot(dot) => epaint::Shape::circle_filled(
|
||||||
self.transform
|
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,
|
dot.c.r as f32 * self.transform.scale().x,
|
||||||
color,
|
color,
|
||||||
),
|
),
|
||||||
Shape::Seg(seg) => epaint::Shape::line_segment(
|
Shape::Seg(seg) => epaint::Shape::line_segment(
|
||||||
[
|
[
|
||||||
self.transform
|
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
|
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),
|
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 {
|
for i in 0..100 {
|
||||||
let x = bend.c.pos.x() + bend.c.r * (angle_from + i as f64 * angle_step).cos();
|
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();
|
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(
|
epaint::Shape::line(
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ impl<'a> Painter<'a> {
|
||||||
Shape::Dot(dot) => {
|
Shape::Dot(dot) => {
|
||||||
let mut path = Path2D::new();
|
let mut path = Path2D::new();
|
||||||
path.ellipse(
|
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,
|
dot.c.r as f32,
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
|
|
@ -31,8 +31,8 @@ impl<'a> Painter<'a> {
|
||||||
}
|
}
|
||||||
Shape::Seg(seg) => {
|
Shape::Seg(seg) => {
|
||||||
let mut path = Path2D::new();
|
let mut path = Path2D::new();
|
||||||
path.move_to(vec2f(seg.from.x() as f32, seg.from.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));
|
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.set_line_width(seg.width as f32);
|
||||||
self.canvas.stroke_path(path);
|
self.canvas.stroke_path(path);
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +45,7 @@ impl<'a> Painter<'a> {
|
||||||
|
|
||||||
let mut path = Path2D::new();
|
let mut path = Path2D::new();
|
||||||
path.arc(
|
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,
|
bend.circle().r as f32,
|
||||||
angle1 as f32,
|
angle1 as f32,
|
||||||
angle2 as f32,
|
angle2 as f32,
|
||||||
|
|
@ -58,8 +58,8 @@ impl<'a> Painter<'a> {
|
||||||
|
|
||||||
let envelope = ShapeTrait::envelope(shape, 0.0);
|
let envelope = ShapeTrait::envelope(shape, 0.0);
|
||||||
// XXX: points represented as arrays can't be conveniently converted to vector types
|
// 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 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 bottomright = vec2f(envelope.upper()[0] as f32, -envelope.upper()[1] as f32);
|
||||||
self.canvas.set_line_width(2.0 / zoom);
|
self.canvas.set_line_width(2.0 / zoom);
|
||||||
self.canvas
|
self.canvas
|
||||||
.set_stroke_style(ColorU::new(100, 100, 100, 255));
|
.set_stroke_style(ColorU::new(100, 100, 100, 255));
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ impl DsnDesign {
|
||||||
Self::add_circle(
|
Self::add_circle(
|
||||||
&mut layout,
|
&mut layout,
|
||||||
(place.x + pin.x) as f64,
|
(place.x + pin.x) as f64,
|
||||||
-(place.y + pin.y) as f64,
|
(place.y + pin.y) as f64,
|
||||||
circle.diameter as f64 / 2.0,
|
circle.diameter as f64 / 2.0,
|
||||||
layer as u64,
|
layer as u64,
|
||||||
*net_id as i64,
|
*net_id as i64,
|
||||||
|
|
@ -113,9 +113,9 @@ impl DsnDesign {
|
||||||
Self::add_rect(
|
Self::add_rect(
|
||||||
&mut layout,
|
&mut layout,
|
||||||
(place.x - pin.x + rect.x1) as f64,
|
(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.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,
|
layer as u64,
|
||||||
*net_id as i64,
|
*net_id as i64,
|
||||||
)
|
)
|
||||||
|
|
@ -130,7 +130,7 @@ impl DsnDesign {
|
||||||
Self::add_path(
|
Self::add_path(
|
||||||
&mut layout,
|
&mut layout,
|
||||||
(place.x - pin.x) as f64,
|
(place.x - pin.x) as f64,
|
||||||
-(place.y - pin.y) as f64,
|
(place.y - pin.y) as f64,
|
||||||
&path.coord_vec,
|
&path.coord_vec,
|
||||||
path.width as f64,
|
path.width as f64,
|
||||||
layer as u64,
|
layer as u64,
|
||||||
|
|
@ -147,7 +147,7 @@ impl DsnDesign {
|
||||||
Self::add_path(
|
Self::add_path(
|
||||||
&mut layout,
|
&mut layout,
|
||||||
(place.x - pin.x) as f64,
|
(place.x - pin.x) as f64,
|
||||||
-(place.y - pin.y) as f64,
|
(place.y - pin.y) as f64,
|
||||||
&polygon.coord_vec,
|
&polygon.coord_vec,
|
||||||
polygon.width as f64,
|
polygon.width as f64,
|
||||||
layer as u64,
|
layer as u64,
|
||||||
|
|
@ -184,7 +184,7 @@ impl DsnDesign {
|
||||||
Self::add_circle(
|
Self::add_circle(
|
||||||
&mut layout,
|
&mut layout,
|
||||||
via.x as f64,
|
via.x as f64,
|
||||||
-via.y as f64,
|
via.y as f64,
|
||||||
circle.diameter as f64 / 2.0,
|
circle.diameter as f64 / 2.0,
|
||||||
layer as u64,
|
layer as u64,
|
||||||
net_id as i64,
|
net_id as i64,
|
||||||
|
|
@ -399,7 +399,7 @@ impl DsnDesign {
|
||||||
let mut prev_index = layout
|
let mut prev_index = layout
|
||||||
.add_fixed_dot(FixedDotWeight {
|
.add_fixed_dot(FixedDotWeight {
|
||||||
circle: Circle {
|
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,
|
r: width / 2.0,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
|
|
@ -412,7 +412,7 @@ impl DsnDesign {
|
||||||
let index = layout
|
let index = layout
|
||||||
.add_fixed_dot(FixedDotWeight {
|
.add_fixed_dot(FixedDotWeight {
|
||||||
circle: Circle {
|
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,
|
r: width / 2.0,
|
||||||
},
|
},
|
||||||
layer,
|
layer,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue