From f14bee1a059cd14d194270ac28b898748e8ca916 Mon Sep 17 00:00:00 2001 From: Kevin Batdorf Date: Sat, 18 Nov 2023 10:20:41 -0500 Subject: [PATCH] Add viewbox fine tuning --- block.json | 4 ++++ readme.txt | 5 ++++- src/Controls.js | 17 ++++++++++++++++- src/Wave.js | 7 ++++--- src/index.js | 4 ++-- wavy-divider.php | 2 +- 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/block.json b/block.json index d492603..40be57e 100644 --- a/block.json +++ b/block.json @@ -53,6 +53,10 @@ "type": "string", "default": "smooth" }, + "viewBoxOffset": { + "type": "number", + "default": 0 + }, "align": { "type": "string", "default": "full" diff --git a/readme.txt b/readme.txt index bd2a70a..d126b3c 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: kbat82 Tags: hr, waves, divider, block, wavy, separator, svg, gradient Tested up to: 6.4 -Stable tag: 1.5.0 +Stable tag: 1.6.0 License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -55,6 +55,9 @@ Within the block inserter, under the Patterns tab, select 'Wavy Divider' from th == Changelog == += 1.6.0 = +- Feature: Add viewBox fine tuning to fix instances where a tiny pixel gap my appear + = 1.5.0 = - Feature: Center wave when only 1 point is selected and is smooth diff --git a/src/Controls.js b/src/Controls.js index b10c01b..2f24195 100644 --- a/src/Controls.js +++ b/src/Controls.js @@ -21,7 +21,8 @@ import { import { dice } from './icons' export const Controls = ({ attributes, setAttributes }) => { - const { points, smoothness, startingPeak, opacity, height } = attributes + const { points, smoothness, startingPeak, opacity, height, viewBoxOffset } = + attributes const showCenteredCurve = points === 1 && smoothness === 'smooth' return ( @@ -81,6 +82,20 @@ export const Controls = ({ attributes, setAttributes }) => { value={opacity} onChange={(opacity) => setAttributes({ opacity })} /> + { + setAttributes({ viewBoxOffset }) + }} + /> diff --git a/src/Wave.js b/src/Wave.js index 7966757..ad0c2e4 100644 --- a/src/Wave.js +++ b/src/Wave.js @@ -7,6 +7,7 @@ export const Wave = ({ opacity, path, fill, + viewBoxOffset = 0, }) => { // Fill is passed in only for the example currently if (!fill) { @@ -20,7 +21,7 @@ export const Wave = ({ + }}> { diff --git a/wavy-divider.php b/wavy-divider.php index 0b8c724..74d3ec0 100644 --- a/wavy-divider.php +++ b/wavy-divider.php @@ -4,7 +4,7 @@ * Description: A creative, fun, lightweight wavy svg divider block to energize your website with character and pizazz * Requires at least: 5.8 * Requires PHP: 7.0 - * Version: 1.5.0 + * Version: 1.6.0 * Author: Kevin Batdorf * License: GPL-2.0-or-later * License URI: https://www.gnu.org/licenses/gpl-2.0.html