aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-11-07 13:48:26 -0500
committerbobzel <zzzman@gmail.com>2023-11-07 13:48:26 -0500
commita6cc25e5d03ffed16bfaa32e48e9cc2eaff7deaf (patch)
tree1322ef9a743457f23851ba7c9d5d3dd090f1f75d /src/Utils.ts
parenta4e3b645317c4589cf49f8007f6e6b57cf2c12d3 (diff)
Changed how selection works to avoid invalidations. Fixed Cast problem with ProxyFields that caused renameEmbedding to infinite loop.. Changed brushing for the same reason. Cleaned up a few things with filter code.
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 330ca59f9..9499aaf2f 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -157,23 +157,19 @@ export namespace Utils {
const isTransparentFunctionHack = 'isTransparent(__value__)';
export const noRecursionHack = '__noRecursion';
- export const noDragsDocFilter = 'noDragDocs::any::check';
+
+ // special case filters
+ export const noDragDocsFilter = 'noDragDocs::any::check';
+ export const TransparentBackgroundFilter = `backgroundColor::${isTransparentFunctionHack},${noRecursionHack}::check`; // bcz: hack. noRecursion should probably be either another ':' delimited field, or it should be a modifier to the comparision (eg., check, x, etc) field
+ export const OpaqueBackgroundFilter = `backgroundColor::${isTransparentFunctionHack},${noRecursionHack}::x`; // bcz: hack. noRecursion should probably be either another ':' delimited field, or it should be a modifier to the comparision (eg., check, x, etc) field
+
export function IsRecursiveFilter(val: string) {
return !val.includes(noRecursionHack);
}
- export function HasTransparencyFilter(val: string) {
- return val.includes(isTransparentFunctionHack);
- }
- export function IsTransparentFilter() {
- // bcz: isTransparent(__value__) is a hack. it would be nice to have acual functions be parsed, but now Doc.matchFieldValue is hardwired to recognize just this one
- return `backgroundColor::${isTransparentFunctionHack},${noRecursionHack}::check`; // bcz: hack. noRecursion should probably be either another ':' delimited field, or it should be a modifier to the comparision (eg., check, x, etc) field
- }
- export function IsOpaqueFilter() {
- // bcz: isTransparent(__value__) is a hack. it would be nice to have acual functions be parsed, but now Doc.matchFieldValue is hardwired to recognize just this one
- return `backgroundColor::${isTransparentFunctionHack},${noRecursionHack}::x`; // bcz: hack. noRecursion should probably be either another ':' delimited field, or it should be a modifier to the comparision (eg., check, x, etc) field
- }
- export function IsPropUnsetFilter(prop: string) {
- return `${prop}::any,${noRecursionHack}::unset`;
+ export function HasFunctionFilter(val: string) {
+ if (val.includes(isTransparentFunctionHack)) return (color: string) => color !== '' && DashColor(color).alpha() !== 1;
+ // add other function filters here...
+ return undefined;
}
export function toRGBAstr(col: { r: number; g: number; b: number; a?: number }) {