marker.rs: Use the correct horizontal/vertical default size

Otherwise LengthDir::Both will cause us to normalize the length incorrectly.
parent e7be0cc5
......@@ -95,17 +95,17 @@ impl NodeMarker {
units: Cell::new (MarkerUnits::default ()),
ref_x: Cell::new (RsvgLength::default ()),
ref_y: Cell::new (RsvgLength::default ()),
width: Cell::new (NodeMarker::get_default_size ()),
height: Cell::new (NodeMarker::get_default_size ()),
width: Cell::new (NodeMarker::get_default_size (LengthDir::Horizontal)),
height: Cell::new (NodeMarker::get_default_size (LengthDir::Vertical)),
orient: Cell::new (MarkerOrient::default ()),
aspect: Cell::new (AspectRatio::default ()),
vbox: Cell::new (None)
}
}
fn get_default_size () -> RsvgLength {
fn get_default_size (dir: LengthDir) -> RsvgLength {
// per the spec
RsvgLength::parse ("3", LengthDir::Both).unwrap ()
RsvgLength::parse ("3", dir).unwrap ()
}
fn render (&self,
......@@ -195,10 +195,10 @@ impl NodeTrait for NodeMarker {
self.ref_x.set (property_bag::length_or_default (pbag, "refX", LengthDir::Horizontal)?);
self.ref_y.set (property_bag::length_or_default (pbag, "refY", LengthDir::Vertical)?);
self.width.set (property_bag::lookup (pbag, "markerWidth").map_or (NodeMarker::get_default_size (),
|v| RsvgLength::parse (&v, LengthDir::Horizontal).unwrap_or (NodeMarker::get_default_size ())));
self.height.set (property_bag::lookup (pbag, "markerHeight").map_or (NodeMarker::get_default_size (),
|v| RsvgLength::parse (&v, LengthDir::Vertical).unwrap_or (NodeMarker::get_default_size ())));
self.width.set (property_bag::lookup (pbag, "markerWidth").map_or (NodeMarker::get_default_size (LengthDir::Horizontal),
|v| RsvgLength::parse (&v, LengthDir::Horizontal).unwrap_or (NodeMarker::get_default_size (LengthDir::Horizontal))));
self.height.set (property_bag::lookup (pbag, "markerHeight").map_or (NodeMarker::get_default_size (LengthDir::Vertical),
|v| RsvgLength::parse (&v, LengthDir::Vertical).unwrap_or (NodeMarker::get_default_size (LengthDir::Vertical))));
self.orient.set (property_bag::parse_or_default (pbag, "orient")?);
self.aspect.set (property_bag::parse_or_default (pbag, "preserveAspectRatio")?);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment