diff --git a/src/plugins/convertPathData.ts b/src/plugins/convertPathData.ts index 3181741..fd4535e 100644 --- a/src/plugins/convertPathData.ts +++ b/src/plugins/convertPathData.ts @@ -48,7 +48,8 @@ export type Params = typeof defaultParams; function fn(item: JsApi, params: Params) { if ( !(item.isElem('path') || item.isElem('clip-path')) || - // TODO: don't optimize the path if it has a name? + // TODO: detect if a path w/ a name can be optimized (i.e. if it isn't being morphed) + item.hasAttr('android:name') || !item.hasAttr('android:pathData') ) { return item; diff --git a/src/plugins/removeEmptyGroups.ts b/src/plugins/removeEmptyGroups.ts index 03eedc3..8844fd0 100644 --- a/src/plugins/removeEmptyGroups.ts +++ b/src/plugins/removeEmptyGroups.ts @@ -6,8 +6,10 @@ import { Plugin } from './_types'; * TODO: are there any empty containers that could be removed in an animated-vector? */ function fn(item: JsApi) { - // TODO: should we remove an empty group if it has a name? we could break an AVD... - return item.isElem('group') && item.isEmpty() ? undefined : item; + // TODO: detect if the group w/ a name is being referenced by an AVD + return item.isElem('group') && !item.hasAttr('android:name') && item.isEmpty() + ? undefined + : item; } export const removeEmptyGroups: Plugin = { diff --git a/test/plugins/convertPathData.21.xml b/test/plugins/convertPathData.21.xml new file mode 100644 index 0000000..1d23ab8 --- /dev/null +++ b/test/plugins/convertPathData.21.xml @@ -0,0 +1,9 @@ + + + + +@@@ + + + + diff --git a/test/plugins/removeEmptyGroups.02.xml b/test/plugins/removeEmptyGroups.02.xml new file mode 100644 index 0000000..0c4bc23 --- /dev/null +++ b/test/plugins/removeEmptyGroups.02.xml @@ -0,0 +1,18 @@ + + + + + + + + + +@@@ + + + + + + + +