mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-11 18:15:20 +00:00
Use WeakDom::full_path_of (#1185)
This commit is contained in:
@@ -8,10 +8,8 @@ use rbx_dom_weak::{
|
|||||||
ustr, Instance, Ustr, WeakDom,
|
ustr, Instance, Ustr, WeakDom,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::syncback::snapshot::inst_path;
|
||||||
multimap::MultiMap, syncback::snapshot::inst_path, REF_ID_ATTRIBUTE_NAME,
|
use crate::{multimap::MultiMap, REF_ID_ATTRIBUTE_NAME, REF_POINTER_ATTRIBUTE_PREFIX};
|
||||||
REF_POINTER_ATTRIBUTE_PREFIX,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub struct RefLinks {
|
pub struct RefLinks {
|
||||||
/// A map of referents to each of their Ref properties.
|
/// A map of referents to each of their Ref properties.
|
||||||
|
|||||||
@@ -222,19 +222,7 @@ pub fn filter_out_property(inst: &Instance, prop_name: &str) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn inst_path(dom: &WeakDom, referent: Ref) -> String {
|
pub fn inst_path(dom: &WeakDom, referent: Ref) -> String {
|
||||||
let mut path = Vec::new();
|
dom.full_path_of(referent, "/")
|
||||||
|
|
||||||
let mut inst = dom.get_by_ref(referent);
|
|
||||||
while let Some(instance) = inst {
|
|
||||||
path.push(instance.name.as_str());
|
|
||||||
inst = dom.get_by_ref(instance.parent());
|
|
||||||
}
|
|
||||||
// This is to avoid the root's name from appearing in the path. Not
|
|
||||||
// optimal, but should be fine.
|
|
||||||
path.pop();
|
|
||||||
|
|
||||||
path.reverse();
|
|
||||||
path.join("/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
Reference in New Issue
Block a user