hundredrabbits / Dotgrid

Minimalist Vector Tool
https://hundredrabbits.itch.io/dotgrid
Other
1.04k stars 75 forks source link

Layers acting as masks #70

Open fkettelhoit opened 4 years ago

fkettelhoit commented 4 years ago

(This depends on the Minimal ViewBox PR, since it needs to calculate the content dimensions to be able to set the white background as the default layer mask with the same dimensions as the content.)

This PR adds a button that lets layers act as masks for the layers farther down, allowing you to cut out parts of the lower layers or add some transparency, depending on the color of the mask layer (black = full transparency, white = no transparency).

layer1_as_mask

Each layer can be toggled between normal mode and mask mode. When a masked layer is manipulated, a dashed outline and handles show the shape and thickness. If another layer is selected, the outline and handles disappear to show the mask effect as it appears in the exported output.

fkettelhoit commented 4 years ago

I just rebased the current master (the new zero-dependency-single-file build is very nice!) for both this PR and the minimal viewBox one. Right now it still hijacks the export button to always export with a viewBox since I couldn't think of an elegant alternative. A second export button would work, of course, but that doesn't sound great. What do you think? Is this even a feature that should be included in Dotgrid?