mirror of
https://github.com/encounter/decomp.dev.git
synced 2026-07-10 03:18:48 -07:00
Add filter option for linked/unlinked TUs (#20)
* forward linked status to ts * Add filter check for linked/unlinked TUs * functions reflect linking status of TU * use correct ts boolean type
This commit is contained in:
@@ -77,6 +77,7 @@ pub struct ReportTemplateUnit<'a> {
|
||||
pub y: f32,
|
||||
pub w: f32,
|
||||
pub h: f32,
|
||||
pub is_linked: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
@@ -584,6 +585,7 @@ fn apply_scope<'a>(
|
||||
}
|
||||
let (w, h) = query.size();
|
||||
let mut units = if let Some(unit) = current_unit {
|
||||
let linked = unit.metadata.as_ref().is_some_and(|m| m.complete.is_some_and(|c| c));
|
||||
unit.functions
|
||||
.iter()
|
||||
.filter_map(|f| {
|
||||
@@ -603,6 +605,7 @@ fn apply_scope<'a>(
|
||||
y: 0.0,
|
||||
w: 0.0,
|
||||
h: 0.0,
|
||||
is_linked: linked,
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
@@ -633,6 +636,10 @@ fn apply_scope<'a>(
|
||||
y: 0.0,
|
||||
w: 0.0,
|
||||
h: 0.0,
|
||||
is_linked: unit
|
||||
.metadata
|
||||
.as_ref()
|
||||
.is_some_and(|m| m.complete.is_some_and(|c| c)),
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
||||
Vendored
+1
@@ -9,6 +9,7 @@ type Unit = {
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
is_linked: boolean;
|
||||
// Runtime fields
|
||||
filtered: boolean;
|
||||
};
|
||||
|
||||
@@ -409,7 +409,14 @@ const SPECIAL_TERM_REGEXP = new RegExp(
|
||||
);
|
||||
|
||||
const checkFilterTermMatches = (term: string, unit: Unit): boolean => {
|
||||
if (term === "is:linked") {
|
||||
return unit.is_linked;
|
||||
} else if (term === "is:unlinked") {
|
||||
return !unit.is_linked;
|
||||
}
|
||||
|
||||
const match = term.match(SPECIAL_TERM_REGEXP);
|
||||
|
||||
if (match) {
|
||||
// Filter based on match percent or size.
|
||||
const operator = match[1];
|
||||
|
||||
Reference in New Issue
Block a user