Skip to content

Commit e1451ed

Browse files
committed
imageFilter
1 parent ff2e501 commit e1451ed

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

docs/features/marks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ All marks support the following style options:
476476
* **strokeDashoffset** - the [stroke dash offset](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset) (typically in pixels)
477477
* **opacity** - object opacity (a number between 0 and 1)
478478
* **mixBlendMode** - the [blend mode](https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode) (*e.g.*, *multiply*)
479+
* **imageFilter** - a CSS [filter](https://developer.mozilla.org/en-US/docs/Web/CSS/filter) (*e.g.*, *blur(5px)*)
479480
* **shapeRendering** - the [shape-rendering mode](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering) (*e.g.*, *crispEdges*)
480481
* **paintOrder** - the [paint order](https://developer.mozilla.org/en-US/docs/Web/CSS/paint-order) (*e.g.*, *stroke*)
481482
* **dx** - horizontal offset (in pixels; defaults to 0)

src/mark.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,14 @@ export interface MarkOptions {
399399
*/
400400
mixBlendMode?: string;
401401

402+
/**
403+
* A CSS [filter][1]; a constant string used to adjust the rendering of
404+
* images, such as *blur(5px)*.
405+
*
406+
* [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/filter
407+
*/
408+
imageFilter?: string;
409+
402410
/**
403411
* The [paint-order][1]; a constant string specifying the order in which the
404412
* **fill**, **stroke**, and any markers are drawn; defaults to *normal*,

src/style.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export function styles(
4444
strokeDashoffset,
4545
opacity,
4646
mixBlendMode,
47+
imageFilter,
4748
paintOrder,
4849
pointerEvents,
4950
shapeRendering
@@ -135,6 +136,7 @@ export function styles(
135136
mark.ariaHidden = string(ariaHidden);
136137
mark.opacity = impliedNumber(copacity, 1);
137138
mark.mixBlendMode = impliedString(mixBlendMode, "normal");
139+
mark.imageFilter = impliedString(imageFilter, "none");
138140
mark.paintOrder = impliedString(paintOrder, "normal");
139141
mark.pointerEvents = impliedString(pointerEvents, "auto");
140142
mark.shapeRendering = impliedString(shapeRendering, "auto");
@@ -368,6 +370,7 @@ export function applyIndirectStyles(selection, mark, dimensions, context) {
368370
applyAttr(selection, "stroke-dasharray", mark.strokeDasharray);
369371
applyAttr(selection, "stroke-dashoffset", mark.strokeDashoffset);
370372
applyAttr(selection, "shape-rendering", mark.shapeRendering);
373+
applyAttr(selection, "filter", mark.imageFilter);
371374
applyAttr(selection, "paint-order", mark.paintOrder);
372375
applyAttr(selection, "pointer-events", mark.pointerEvents);
373376
}

0 commit comments

Comments
 (0)