pub struct Viewport {
pub id: Option<String>,
pub x: f64,
pub y: f64,
pub ox: f64,
pub oy: f64,
pub width: f64,
pub height: f64,
pub layers: Vec<Layer>,
}Expand description
One molecule viewport in a diagram (after ELK/grid placement).
x/y are the mol group’s placement in the parent. ox/oy are the
leftover fit origin of local primitive coords. SVG is
translate(x,y) translate(ox,oy) around nested layer groups — primitives
stay in paint space; the group carries the transform.
Fields§
§id: Option<String>§x: f64§y: f64§ox: f64Local leftover origin (fit). Nested inside the mol group, not baked
into path d.
oy: f64§width: f64§height: f64§layers: Vec<Layer>Implementations§
Source§impl Viewport
impl Viewport
Sourcepub fn local_origin(&self) -> (f64, f64)
pub fn local_origin(&self) -> (f64, f64)
Document-space origin of this mol’s local primitive coords.
Sourcepub fn extend_layer(&mut self, name: LayerName, prims: Vec<Primitive>)
pub fn extend_layer(&mut self, name: LayerName, prims: Vec<Primitive>)
Append primitives to the named layer, creating it if needed.
Sourcepub fn prepend_layer(&mut self, name: LayerName, prims: Vec<Primitive>)
pub fn prepend_layer(&mut self, name: LayerName, prims: Vec<Primitive>)
Put primitives under existing ink of the named layer (regions under shade).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Viewport
impl<'de> Deserialize<'de> for Viewport
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Viewport
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnsafeUnpin for Viewport
impl UnwindSafe for Viewport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more