update README to include rounded corners example#259
Open
BaderSerhan wants to merge 1 commit intomohebifar:masterfrom
Open
update README to include rounded corners example#259BaderSerhan wants to merge 1 commit intomohebifar:masterfrom
BaderSerhan wants to merge 1 commit intomohebifar:masterfrom
Conversation
rexfordessilfie
left a comment
There was a problem hiding this comment.
LGTM! Thank you so much for this @BaderSerhan and @@arifqys! I was starting to itch for it. I left a small comment about parameterizing the border radius. What do you think?
Regarding masks, I wonder if this package could also export some standard SVG masks out of the box. It would also be nice to be able to specify SVG masks per step/tour if/when multi-tours are provided. If you are interested, would you mind creating an issue/PR for it, for when @mohebifar and others to take a look at?
Comment on lines
+256
to
+265
| const roundedRectangleSvgPath = ({ position, canvasSize, size }) => { | ||
| const br = 10; // border radius | ||
| const sizeX = size.x._value - 2 * br; | ||
| const sizeY = size.y._value - 2 * br; | ||
| return `M 0 0 H ${canvasSize.x} V ${canvasSize.y} H 0 V 0 Z M ${position.x._value+br} ${position.y._value} Z h ${sizeX} a ${br} ${br} 0 0 1 ${br} ${br} v ${sizeY} a ${br} ${br} 0 0 1 -${br} ${br} h -${sizeX} a ${br} ${br} 0 0 1 -${br} -${br} v -${sizeY} a ${br} ${br} 0 0 1 ${br} -${br} z`; | ||
| } | ||
|
|
||
| copilot({ | ||
| svgMaskPath: circleSvgPath | ||
| })(RootComponent); |
There was a problem hiding this comment.
Love this! Do you think we could make a slight tweak to the example to parameterize the border radius? It could make it more usable for folks
Suggested change
| const roundedRectangleSvgPath = ({ position, canvasSize, size }) => { | |
| const br = 10; // border radius | |
| const sizeX = size.x._value - 2 * br; | |
| const sizeY = size.y._value - 2 * br; | |
| return `M 0 0 H ${canvasSize.x} V ${canvasSize.y} H 0 V 0 Z M ${position.x._value+br} ${position.y._value} Z h ${sizeX} a ${br} ${br} 0 0 1 ${br} ${br} v ${sizeY} a ${br} ${br} 0 0 1 -${br} ${br} h -${sizeX} a ${br} ${br} 0 0 1 -${br} -${br} v -${sizeY} a ${br} ${br} 0 0 1 ${br} -${br} z`; | |
| } | |
| copilot({ | |
| svgMaskPath: circleSvgPath | |
| })(RootComponent); | |
| function rectangleSvgPath({ borderRadius: br = 2 } = {}) { | |
| function path({ position, canvasSize, size }) { | |
| const sizeX = size.x._value - 2 * br; | |
| const sizeY = size.y._value - 2 * br; | |
| return `M 0 0 H ${canvasSize.x} V ${canvasSize.y} H 0 V 0 Z M ${ | |
| position.x._value + br | |
| } ${ | |
| position.y._value | |
| } Z h ${sizeX} a ${br} ${br} 0 0 1 ${br} ${br} v ${sizeY} a ${br} ${br} 0 0 1 -${br} ${br} h -${sizeX} a ${br} ${br} 0 0 1 -${br} -${br} v -${sizeY} a ${br} ${br} 0 0 1 ${br} -${br} z`; | |
| } | |
| return path; | |
| } | |
| copilot({ | |
| svgMaskPath: rectangleSvgPath({ borderRadius: 10 }) | |
| })(RootComponent); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Credits to @arifqys for providing the custom SVG path.