Skip to content

Conversation

sqwarellc
Copy link
Contributor

Updates dropShadow to support flood-color and flood-opacity attributes, per side discussion in Issue #63.

The thing I'm not sure about is on Line 53 of
svg.filter.js.d.ts - should color: be SVGAnimatedString ? Or something different.

Adding flood-color, flood-opacity support to dropShadow per Issue 63 side-discussion. Also may have fixed missing "in" parameter for dropShadow not showing up in at least one IDE (phpStorm).
Adding flood-color and flood-opacity attributes per side discussion in Issue 63.
(Removed attempt at fixing problem where attribute list doesn't show up correctly in my IDE, wrong approach.)
@Fuzzyma
Copy link
Member

Fuzzyma commented Mar 19, 2023

The change looks solid. I am actually lot sure what type the color has.

We only included the feDropShadow interface in the types because it wasn't in the official typescript Dom types when we released. However it was added in the meantime so we probably can get rid of the whole interface (even tho the official interface does not include the flood and opacity attributes yet. But since you rarely actually access the Dom element through svg.js, it doesn't matter too much in my opinion).

However if you want you can figure out the type yourself by creating a drop shadow filter with a flood color and print out in the console the value of the attribute:

const mydropshadow = filter.dropShadow(...)
console.log(mydropshadow.node.floodColor)

In Theorie that should print the object to the console together with its type.

Personally I would just remove the whole interface

@sqwarellc
Copy link
Contributor Author

OK, this is major beginner stupid-question time... I would like to do the test you described above to look at the floodColor attribute.

When I download my branch of the code tree to my local machine, I replace the code that loads the production version of svg.filter.js with my branch, but the resulting page just hangs with no output (and no errors on the console). What am I missing?

// original load of production version
<script src="svg.filter.js/svg.filter.js"></script>
// modified to load local copy of my modified branch
<script src="svg.filter.js-patch-1/src/svg.filter.js"></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants