Commit Graph

761 Commits (39482d3fe9558995cc399371be025d951ec7ae36)

Author SHA1 Message Date
Isaiah Odhner 39482d3fe9 Hide tool previews when appropriate 2019-10-01 18:45:32 -04:00
Isaiah Odhner efec7f62bb WIP: hide tool previews when appropriate 2019-10-01 18:41:33 -04:00
Isaiah Odhner 089a09daa8 Fix returning to zoom selected with Custom Zoom 2019-10-01 15:23:44 -04:00
Isaiah Odhner a5fcf53b42 Update brush preview color when not drawing 2019-10-01 15:07:35 -04:00
Isaiah Odhner e878239be5 Implement View > Zoom > Custom... 2019-10-01 14:25:33 -04:00
Isaiah Odhner 4bc4d34c5d doot 2019-10-01 13:34:20 -04:00
Isaiah Odhner 0efd05c68f ES6 2019-10-01 13:24:24 -04:00
Isaiah Odhner 9ffb5a6758 WIP: brush tool preview 2019-10-01 12:51:29 -04:00
Isaiah Odhner 504416b404 Make Free-Form Select's shape preview play well with the grid
Use the singular helper layer. This was actually super easy and simplifies things, I like it.
2019-10-01 12:40:16 -04:00
Isaiah Odhner f36aca9e1c Hide grid at unuseful scales (from browser zoom) 2019-10-01 12:27:17 -04:00
Isaiah Odhner 59a4e9d7a3 Update grid on scroll 2019-10-01 12:19:25 -04:00
Isaiah Odhner d1b71c9a61 Update eraser preview position 2019-10-01 11:25:26 -04:00
Isaiah Odhner aab5fb82a2 Get it working (fix overflow) 2019-10-01 11:22:29 -04:00
Isaiah Odhner 1eecb05a6c Hey! Hey! Hey! 2019-10-01 11:09:31 -04:00
Isaiah Odhner 5795c897fb WIP 2019-10-01 10:57:15 -04:00
Isaiah Odhner 57057611be Refactor 2019-10-01 10:44:37 -04:00
Isaiah Odhner c82e24c58d Fix nothing :( 2019-10-01 00:42:07 -04:00
Isaiah Odhner 0398952e4f WIP... 2019-10-01 00:37:57 -04:00
Isaiah Odhner 0f9342d5eb WIP! 2019-10-01 00:32:22 -04:00
Isaiah Odhner faae73e55f WIP 2019-10-01 00:09:18 -04:00
Isaiah Odhner 817b8488cd WIP 2019-10-01 00:06:07 -04:00
Isaiah Odhner c6489773dd WIP: fix performance with helper layer 2019-10-01 00:02:48 -04:00
Isaiah Odhner df021f1540 Don't update statusbar with nonsense from helper layer 2019-09-30 23:58:11 -04:00
Isaiah Odhner 091a6eaab1 Finish helper layer refactor
- Merge some functions related to the helper layer updating
- Don't create a new helper layer (and thus canvas) each time
2019-09-30 23:31:05 -04:00
Isaiah Odhner 62f3d18438 WIP towards fixing performance with helper layer
Fun accidental behavior: draw weird bit patterns by zooming in and out with the grid.
2019-09-30 20:34:02 -04:00
Isaiah Odhner 83db679de0 thasdone 2019-09-30 19:54:29 -04:00
Isaiah Odhner e827517bfd Position hairline border over grid when shown
So many details, man!
2019-09-30 19:50:48 -04:00
Isaiah Odhner 40d85e5bb3 Hairline eraser preview border 2019-09-30 19:50:48 -04:00
Isaiah Odhner 27171c24ce WIP eraser preview 2019-09-30 19:50:48 -04:00
Isaiah Odhner 5aa23766c6 Simplify quick undo
Press any buttons on any pointing device while drawing to cancel.
2019-09-30 19:50:48 -04:00
Isaiah Odhner 71a1883146 Fix regression with making document Opaque 2019-09-30 19:50:48 -04:00
Isaiah Odhner 6ac691e9bd Avoid antialiasing in more scenarios
Enable aliasing (nearest neighbor scaling) for more scenarios. This improves quality at some scales of the canvas and device pixel ratios, by re-enabling aliasing. In particular this avoids a browser bug in chrome where the canvas will jump back and forth between being antialiased and aliased, but only for these certain scenarios. Any time it's antialiased, it can also exhibit this bug in chrome.
2019-09-30 19:50:48 -04:00
Isaiah Odhner 7f9b7fb096 Update grid when zooming 2019-09-30 19:50:48 -04:00
Isaiah Odhner 101f2f6201 Toggle grid with menu item or Ctrl+G 2019-09-30 19:50:48 -04:00
Isaiah Odhner f65e67c491 Don't suggest Ctrl+W which closes browser tab 2019-09-30 19:50:48 -04:00
Isaiah Odhner 26084174ea Refactor 2019-09-30 19:50:48 -04:00
Isaiah Odhner b8fc07bae1 Fix grid for non-integer devicePixelRatio 2019-09-30 19:50:48 -04:00
Isaiah Odhner b8c60a1ebb WIP Grid
Currently always shown for scales where it's available.

TODO: View > Zoom > Show Grid menu item and Ctrl+G keyboard shortcut, and fix hiDPI scaling with non-integer devicePixelRatio
2019-09-30 19:50:48 -04:00
Isaiah Odhner f1abaa7304 Make parameter for hiding the main canvas handles 2019-09-30 19:50:48 -04:00
Isaiah Odhner 87e15d3cf2 Fix horrible lag with multitools
For each tool for each tool -> for each tool. I didn't think about it very much when I was adding this silly feature.
2019-09-30 19:50:48 -04:00
Isaiah Odhner 3e777cb5b7 Add safety measures 2019-09-30 19:50:48 -04:00
Isaiah Odhner 0421882eaf Save undos/redos as ImageData & fix Free-Form Select
- (PARTIALLY avoid a browser bug in chrome. When you zoom to a non-integer scale, there's this weird quantum antialiasing due to the canvas having a backing store which is higher density than the canvas's logical pixels (and redraw regions come into play as well). Switching to storing ImageData instead of canvases for undos/redos doesn't eliminate much of this problem, but it avoids having the undos/redos also store some high-DPI state and thereby SOMETIMES restore a state of whether antialiasing is happening or not. So it's a little less weird now, but it doesn't really solve that bugginess.)
- Protect against data loss when running low on memory. The browser (chrome at least) can clear canvases when low on memory. If the data is erased, and you undo, or do anything to the canvas, jspaint saves over the autosave. Ideally there should be multiple autosaves, but for now this is catastrophic in terms of data loss. Using ImageData instead of canvases, hopefully the browser is less willing to destroy this data, since it's more like a plain data structure in your program, and you would hope it wouldn't just delete arbitrary data in your program. A crash should be better than losing the canvas data (undos/redos) because in that case the autosave should still be in tact, altho this doesn't protect against the case where the main canvas is cleared by the browser, and then you do something to interact with the canvas other than undo/redo, and then either the page crashes or you refresh, and the autosave will still be gone.
- Behavior change or Regression: Now if the document is transparent, but the document mode is opaque, and you paste something larger than the canvas, it'll keep the transparency in the area of the original document, because it's using putImageData instead of drawImage.
- Regression: When you choose Opaque in the Image > Attributes... it no longer makes the document opaque because it's using putImageData instead of drawImage.
- Fix: Rewrite the Free-Form Select's temporary shape preview to use a proper layer instead of abusing the undo stack. This reduces the number of undo states created, and should make it easier to implement passive selections in the future. (Selections shouldn't create an undo state until you start dragging them.) This should also fix a bug in multiplayer where "inverty brush" could be left behind.
2019-09-30 19:50:48 -04:00
Isaiah Odhner 2a5206a2c5 Enable antialiasing at awkward pixel sizes
Compromise for https://github.com/1j01/jspaint/issues/103

Note that this uncovers weird buggy browser behavior where canvas HiDPI state is remembered per undo state, and can fluctuate based on mouse presses (often makes it go antialiased) and undoing (often makes it go aliased), and it can even go partially antialiased, in redraw regions as you paint.

Also it definitely needs additional handling for the canvas itself, which can have a magnification factor.
2019-09-29 22:04:20 -04:00
Isaiah Odhner 2079717ea2 Tweak 36x36 icon in Paint.NET
which is a way better editor
2019-09-29 14:53:31 -04:00
Isaiah Odhner d4872d85a3 Pixel 36x36 icon a bit in jspaint based on 32x32 2019-09-29 14:42:13 -04:00
Isaiah Odhner dac402b64b Clean up icon files
Use a (more) consistent naming scheme
2019-09-29 14:36:45 -04:00
Isaiah Odhner 5a2bc6287e Tweak safari pinned tab icon based on 16px bitmap icon 2019-09-29 14:29:29 -04:00
Isaiah Odhner 0f8d1c6c4e Make safari pinned tab icon 16px 2019-09-29 14:10:57 -04:00
Isaiah Odhner bc1afbab52 Add Safari pinned tab icon 2019-09-29 13:22:04 -04:00
Isaiah Odhner 278ee910c3 Comment quick undo code and rename var 2019-09-28 23:37:14 -04:00