Repository navigation
Conversation
@react-sketch/bucket renders the objects of a canvas, finds the area of the pixels connected to a point, grows it under the lines around it, and makes its outline a path (a FillPath, saved and loaded as a BucketFill). The area has to be closed within the canvas, and the fill goes over the object the area is in and under the ones which close it. The package is private and built with the other two by build:packages.
tool="bucket-fill" (Tools.BucketFill, Types.Tool.BUCKET_FILL) fills the area which is closed around a click with fillColor, or lineColor while fillColor is transparent. A click where the area is not closed does nothing. The fill goes under the lines which close the area, so the history keeps the place of an object which is not on top: undo of a removal and redo of an addition put it back where it was, and not over the lines.
The bucket fill button (key F) fills with the fill color, whether the shapes are filled or not, and its properties show the fill color only.
This branch has not been deployed
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.
Summary
Adds the bucket fill tool: a click fills the area which is closed around it with
fillColor(lineColorwhilefillColoris transparent).BucketFill): one undo step, saved bytoJSON(), loaded byvalue,defaultValueandfromJSON(), scaled with the canvas. It is under the lines which close the area, a pixel under their edge, and over the object the area is in.@react-sketch/bucket, whichreact-sketchbundles likeeraserandlaserpointer.Behavior change
Undo of a removal puts the object back where it was among the objects, and not on top. Redo of an addition does the same for an object added under the others (the fill). Without it, a fill removed and brought back would cover its lines. One existing test (
removes the selected object, and undo brings it back) asserted the old order and is updated. It is listed under Changed in the CHANGELOG.Testing
yarn format:check,yarn lint,yarn typecheck,yarn buildpass.yarn testpasses (533 tests), also withREACT=18.bucketFill.spec.ts) run in the node environment of Jest with the node build of fabric, as the canvas mock of jsdom has no pixels.Notes
1.2.0heading, without a date.