Commit Graph

115 Commits (20edcb5d81396497ee8c94ede6e2616102185d1e)

Author SHA1 Message Date
Isaiah Odhner ee85eb5f38 Use more localized strings 2021-01-31 01:02:20 -05:00
Isaiah Odhner f3952515b4 Handle failure to get WebGL context 2020-12-04 10:47:00 -05:00
Isaiah Odhner 0cfc7332fa Introduce slight threshold to fill operations
Fixes https://github.com/1j01/jspaint/issues/184
2020-12-04 10:47:00 -05:00
Isaiah Odhner 882fa50381 Use theme colors for tool options
- Fix the contrast of (most) tool options in the new dark theme
- (There isn't very good contrast for the shape style options in this dark theme.)
- Simplify events for re-rendering tool options
- Re-render tool options when dropping in a .theme/.themepack file
2020-05-29 23:56:14 -04:00
Isaiah Odhner 31edf30064 Unify TODO comments 2020-04-27 20:45:47 -04:00
Isaiah Odhner 6a0d597ab3 Remove unused 2020-04-18 19:05:30 -04:00
Isaiah Odhner e4a3018c5c Rename flood-filling sub-functions 2020-01-05 17:14:28 -05:00
Isaiah Odhner 2c0aeb60c0 Improve action names
"Invert Selection" was ambiguous, could mean selecting the opposite set of pixels.
"Rotate 90 degrees Selection" was ungrammatical.
I could template the names so that it was "Invert Selection Colors", "Rotate Selection 90 degrees", but for now, putting parentheses around "Selection" works fine.
2020-01-05 11:59:27 -05:00
Isaiah Odhner a9fe8e3553 Optionally convert to monochrome (with a threshold) 2020-01-05 11:59:25 -05:00
Isaiah Odhner 29765b797b Support patterns for global color replacement 2019-12-23 15:03:24 -05:00
Isaiah Odhner 14cf228157 Support patterns for Fill With Color 2019-12-23 13:50:24 -05:00
Isaiah Odhner 42de87ff38 Invalidate brush caches when restoring WebGL context 2019-12-21 00:38:42 -05:00
Isaiah Odhner f70277f0bd Clean up unused parameters 2019-12-21 00:38:38 -05:00
Isaiah Odhner 9e8b56d41b Fix accidental global "pixel_pos" 2019-12-21 00:38:35 -05:00
Isaiah Odhner 226dc4348c Perf: use brush cache for Brush tool options 2019-12-21 00:38:32 -05:00
Isaiah Odhner 1515016bf7 Simplify tool options chooser event handling 2019-12-21 00:38:31 -05:00
Isaiah Odhner 51fe6913ee Fix parenting of image transform undoables
`cancel()` inside `undoable()` action callback caused it to navigate history,
and it would navigate all the way to the start of the last pointer gesture because
`history_node_to_cancel_to` was only set on pointerdown, not taking into account non-pointer-gesture operations.
The point was to allow undoing Fill With Color when canceling, but with the old definition of `history_node_to_cancel_to` it would have needed to be set in scattered places.
Now I'm defining it where it can be null, and if it's null, canceling should just go back to the history node at the start of `cancel()` (after making history nodes if applicable by telling tools to finish).
2019-12-21 00:38:16 -05:00
Isaiah Odhner 6f819c7555 Fix app-breaking Stretch/Skew to zero width/height 2019-12-21 00:38:14 -05:00
Isaiah Odhner 9948d8f9bb DRY 2019-12-21 00:38:13 -05:00
Isaiah Odhner 433b01f1f3 Add icons for stretching and skewing 2019-12-21 00:38:12 -05:00
Isaiah Odhner 96d6d4c064 Add icons for flipping and rotating actions 2019-12-21 00:38:12 -05:00
Isaiah Odhner be216e5aad Add action icon for Invert 2019-12-21 00:38:11 -05:00
Isaiah Odhner f9069fd8ab DRY image inversion code 2019-12-21 00:38:10 -05:00
Isaiah Odhner 3e2146adaa Mark selection transformations as soft 2019-12-21 00:38:05 -05:00
Isaiah Odhner d19d2a80d5 Clean up and guard console logs 2019-12-21 00:38:00 -05:00
Isaiah Odhner 1d9f56d0d4 Restructure arguments to undoable() 2019-12-21 00:37:50 -05:00
Isaiah Odhner bc3a450c47 Include selection and selection operations in history 2019-12-21 00:37:46 -05:00
Isaiah Odhner 6d7220f60e Re-enable line drawing >1px width 2019-12-21 00:37:29 -05:00
Isaiah Odhner 9a72ee964f Stamp to make brush/pencil whole again 2019-12-21 00:37:26 -05:00
Isaiah Odhner b1335343d6 WIP: optimize brush, pencil, & eraser performance
The plan is to try drawing a set of lines with WebGL based on the border of the shape of the brush.
2019-12-21 00:37:20 -05:00
Isaiah Odhner 703fcd6105 Get rid of canvas-change.js
- Remove the whole ugly hacky module. Most things only modify the canvas when creating undoables now. Only a few things modify undoables after creating them.
- Formally disable pointer operations playback, instead of just leaving it accidentally disabled.
2019-12-21 00:37:15 -05:00
Isaiah Odhner dae22f837f Improve WebGL context loss handling 2019-12-08 23:00:35 -05:00
Isaiah Odhner 987d6e8d4c More detail! 2019-12-08 13:07:27 -05:00
Isaiah Odhner 85e8922c08 Name undoables with details 2019-12-08 13:07:27 -05:00
Isaiah Odhner a862d5b7b8 Name undoables 2019-12-08 11:52:12 -05:00
Isaiah Odhner f4fb65ee88 Remove redo data deletion dialog 2019-12-08 10:52:06 -05:00
Isaiah Odhner 0e3e90e170 Simplify
- Break out contents of poorly named function (punction?) "this_ones_a_frame_changer"
- Remove need for setTimeout
2019-12-08 10:45:08 -05:00
Isaiah Odhner ecb6b8003d Add support check for Edge
https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform
2019-12-04 13:46:45 -05:00
Isaiah Odhner 593cddac09 Clean up
No more "var" declarations
2019-11-03 10:39:48 -05:00
Isaiah Odhner 13fa15e7a9 Implement perfect tool previews for Select and Text tools
- Instead of creating an OnCanvasTextbox or OnCanvasSelection object during selection, draw the preview in the tool
- Get it looking exactly like it does in mspaint (as far as I can tell)
- Fix how selection rect is determined
- Don't create textbox or selection if width or height would be 1
- Don't draw unless the pointer has moved
2019-11-01 18:56:49 -04:00
Isaiah Odhner a2a6c7d9ef Use default params
lebab --replace src/ --transform default-param
2019-10-29 18:15:45 -04:00
Isaiah Odhner 83dd05c1b0 Clean up canvas creation
Don't pretend the canvas making helper is a class
2019-10-29 17:49:17 -04:00
Isaiah Odhner 6e130de69e Use template strings
lebab --replace src/ --transform template
2019-10-29 17:16:33 -04:00
Isaiah Odhner d0f4b08690 Fix lint 2019-10-29 17:08:13 -04:00
Isaiah Odhner ad24e53e65 Fix indentation 2019-10-29 17:00:31 -04:00
Isaiah Odhner af6e9a1242 Convert var to let and const
$ lebab --replace src/ --transform let
src/$Component.js:
59:   warning  Unable to transform var  (let)
60:   warning  Unable to transform var  (let)
97:   warning  Unable to transform var  (let)
138:  warning  Unable to transform var  (let)
src/$Window.js:
74:   warning  Unable to transform var  (let)
src/app.js:
662:  warning  Unable to transform var  (let)
460:  warning  Unable to transform var  (let)
612:  warning  Unable to transform var  (let)
613:  warning  Unable to transform var  (let)
614:  warning  Unable to transform var  (let)
src/functions.js:
756:  warning  Unable to transform var  (let)
src/image-manipulation.js:
245:  warning  Unable to transform var  (let)
826:  warning  Unable to transform var  (let)
src/imgur.js:
48:   warning  Unable to transform var  (let)
173:  warning  Unable to transform var  (let)
2019-10-29 16:46:51 -04:00
Isaiah Odhner d0e722d12c Convert to arrow functions with lebab
npm install -g lebab@3.1.0

lebab --replace src/ --transform arrow
2019-10-29 14:46:29 -04:00
Isaiah Odhner 1127b53d72 Always render helper layer at screen pixel scale
- Always use screen pixel scale for helper layer
- Move responsibility for non-integer handling into draw_grid (instead of using an integer scale for the whole helper layer)
- This allows the Magnifier viewport preview and Eraser preview to draw with a consistent line width
- TODO: Try applying sub-1px margin or padding or left/top or translate or something to canvas-area to get helper layer canvas to line up with screen pixels perfectly
2019-10-28 19:42:36 -04:00
Isaiah Odhner bc69f1a794 Clamp brush sizes after context loss
just in case
2019-10-23 16:42:38 -04:00
Isaiah Odhner 3ae98432c5 Restore brush after context loss 2019-10-23 16:42:38 -04:00