#[typetag::serde]
pub trait InertPieceTrait: OutlineTrait {
- fn svg(&self, f: &mut Html, id: VisiblePieceId) -> Result<(),IE>;
+ fn nfaces(&self) -> RawFaceId;
+
+ /// When used for occultated version of another object,
+ /// face used is always default, regardless of nfaces.
+ fn svg(&self, f: &mut Html, id: VisiblePieceId, face: FaceId)
+ -> Result<(),IE>;
fn describe_html(&self) -> Result<Html,IE>;
}
ipc.show(y).svg_piece(&mut defs, gpc, gs, pri.vpid)?;
},
Right(i) => {
- i.svg(&mut defs, pri.vpid)?;
+ i.svg(&mut defs, pri.vpid, default())?;
},
};
}}}
#[typetag::serde(name="Lib")]
impl InertPieceTrait for ItemInertForOcculted {
+ fn nfaces(&self) -> RawFaceId { 1 }
+
#[throws(IE)]
- fn svg(&self, f: &mut Html, _: VisiblePieceId) {
+ fn svg(&self, f: &mut Html, _: VisiblePieceId, face: FaceId) {
+ if face != FaceId::default() {
+ throw!(internal_logic_error("ItemInertForOcculted non-default face"))
+ }
self.xform.write_svgd(f, &self.svgd)?;
}
#[throws(IE)]
let svgd = &self.svgs[face.svg];
face.xform.write_svgd(f, svgd)?;
} else if let Some(back) = &self.back {
- back.svg(f, vpid)?;
+ back.svg(f, vpid, default())?;
} else {
throw!(internal_error_bydebug(&(self, face)))
}
#[typetag::serde(name="LibItem")]
impl InertPieceTrait for Item {
+ fn nfaces(&self) -> RawFaceId { <Item as PieceTrait>::nfaces(self) }
+
#[throws(IE)]
- fn svg(&self, f: &mut Html, id: VisiblePieceId) {
- self.svg_face(f, default(), id)?;
+ fn svg(&self, f: &mut Html, id: VisiblePieceId, face: FaceId) {
+ self.svg_face(f, face, id)?;
}
#[throws(IE)]
fn describe_html(&self) -> Html {