Commit Graph

1396 Commits (main)

Author SHA1 Message Date
radex a03ea047c1
fix printing? 2024-02-02 22:21:56 +01:00
radex 4664a50c8a
move monochrome switch to HSWAW menu (it's a bit broken at launch) 2024-02-02 21:34:07 +01:00
radex 6eb8e4323b
Add print on Zebra 2024-02-02 21:31:18 +01:00
radex 125df83f99
Default to monochrome 2024-02-02 21:19:06 +01:00
radex d6f0dc39a0
Change default canvas size 2024-02-02 21:18:34 +01:00
Isaiah Odhner 8ea4743f7f Rename local storage key variable 2024-01-29 23:49:31 -05:00
Isaiah Odhner 7d9e37c02d Do not do "dont"; do "do-not"
Not your head if you understand. OOOH burn!
2024-01-29 23:34:50 -05:00
Isaiah Odhner 2ee58567cc Fix mixed tabs/spaces 2024-01-28 21:51:32 -05:00
Isaiah Odhner 8d3543946b Use Local Font Access API when available
This restores the ability to use arbitrary installed fonts with the Text tool, which previously worked using the Flash plugin.

This functionality should ideally be included in FontDetective, but it was easier to get it working in JS Paint first.
2024-01-26 22:45:36 -05:00
milksteakjellybeans c5cf78424c Update tools.js's TOOL_RECTANGLE so that rectangles have sharp edges, working around weirdness in latest Firefox
As discussed in https://github.com/1j01/jspaint/issues/326,
the drawing of rectangles show a blurred/anti-aliased edge in the recent versions of Firefox.  This change restores sharp edges in Firefox.  The change is modeled after how the existing code  handles the degenerate case of drawing the rectangle (when the rectangle is either not as tall or not as wide as double the rectangle line width), but this version just draws four rectangles, one for each side.
2023-11-10 04:32:58 -05:00
Isaiah Odhner 12a90c6bb9 Focus nearby Remove button in storage manager when hitting Remove
The window shouldn't lose focus when you press Remove.
2023-02-14 09:31:56 -05:00
Isaiah Odhner eee7179cf8 Focus first input by default in Stretch/Skew dialog 2023-02-14 09:31:56 -05:00
Isaiah Odhner 7e4ebb7143 Focus first radio option by default in Flip/Rotate dialog 2023-02-14 09:31:56 -05:00
Isaiah Odhner 7db534a49b Make $Button safely treat text as plain again (not HTML)
I'm not terribly worried about XSS here, but it is a good practice to
avoid implicit HTML parsing. Mainly, though, I really don't want to
go through every button in my app to make sure the formatting is okay,
so I'm changing this back to treating text as text, and handling the one
place where I need HTML specially, by passing an Element instead.
2023-02-14 09:31:56 -05:00
Isaiah Odhner 2bd020711c Allow modifier-less shortcuts in Attributes dialog 2023-02-14 09:31:56 -05:00
Isaiah Odhner 5ad32de21f Add keyboard shortcuts to image attributes dialog
- DANGER: I made $Button treat the label parameter as HTML.
  This is terrible! What am I doing?
- Note: MS Paint actually supports modifier-less shortcuts when no
  textual input is focused. I should do what I did for the Custom Zoom
  window here too, but I haven't yet.
2023-02-14 09:31:56 -05:00
Isaiah Odhner 434e975ef4 Allow modifier-less digit shortcuts while custom zoom input not focused
MS Paint supports pressing 1, 2, 4, 6, or 8 with or without a modifier,
to select the corresponding zoom levels, but it doesn't have a textual
numeric input field to contend with.

I'm handling this by conditionally enabling the digit shortcuts without
a modifier, and always enabling the digit shortcuts with Alt.
2023-02-14 09:01:20 -05:00
Isaiah Odhner e274a1ddfb Add keyboard shortcuts for zoom levels in Custom Zoom dialog
This matches the original MS Paint dialog. Thankfully both Chrome and
Firefox allow overriding the shortcut to switch tabs with Alt+1-9.
2023-02-14 09:01:20 -05:00
Isaiah Odhner a8bd0499fa Update "Current zoom" if magnification changes while dialog is open
This can't happen in the original MS Paint, but it's fine, I can just
handle it. I didn't even have to type half of this code.
I love AI autocomplete. I especially love turning TODO comments into
comments that guide the AI with natural language.
2023-02-14 09:01:20 -05:00
Isaiah Odhner a3a1d83252 Fix selecting custom zoom field when clicking label 2023-02-14 09:01:20 -05:00
Isaiah Odhner 861ae2a7e8 Prevent strange behavior when clicking on custom zoom field
The field itself should be focused when clicking on the field directly,
and the caret should be placed where you click.

You know, I thought of this solution quickly, and GitHub Copilot
autocompleted it, but I'm having trouble pinning down what the problem
actually was.

Why does focusing this input programmatically lead to the input not
being focused ultimately after the click? At any rate, letting it focus
naturally works, and is clearly superior.

Note: This buggy behavior was showing up in Firefox.
2023-02-14 09:01:20 -05:00
Isaiah Odhner 60c8a0f7a4 Select custom zoom radio when typing in custom zoom field
This prevents a confusing scenario where you tab to the field rather
than clicking on it, type a custom zoom value, and hit Enter/OK, and
it's not used because the radio for a standard zoom value is still
selected.
2023-02-14 03:06:00 -05:00
Isaiah Odhner 26524b188a Prevent form submit event instead of button click event
Neither are generally effective since the submit event doesn't fire
due to the form being removed from the DOM when the window closes.
But this is cleaner/safer, more general, as a safety measure.
2023-02-14 02:38:15 -05:00
Isaiah Odhner 5bf1b59e94 Start typing into custom zoom level field even with a decimal point 2023-02-13 23:11:20 -05:00
Isaiah Odhner 1aa91aadad Start typing into custom zoom level text field if its radio is focused 2023-02-13 23:07:35 -05:00
Isaiah Odhner 06a5fe2c87 Handle initial focus for default button highlighting 2023-02-13 20:29:18 -05:00
Isaiah Odhner fb7f31064d Focus current zoom level's associated control in Custom Zoom 2023-02-13 20:29:18 -05:00
Isaiah Odhner 500d9eb052 Focus first color cell, not OK button, as fallback in Edit Colors 2023-02-13 20:29:08 -05:00
Isaiah Odhner 0e0062577d Tweak submit button determination
- Merge the two cases of [type="submit"] and plain buttons,
  matching the HTML semantics that plain buttons are literally submit
  buttons (at least if they're in a form), and not lower priority
  than buttons explicitly marked with type="submit".
- Never consider button[type="button"] a submit button.
  A button with type="button" should only be highlighted if focused.
2023-02-13 20:27:03 -05:00
Isaiah Odhner d4018c112a Handle pressing Enter in Edit Colors dialog 2023-02-13 20:27:03 -05:00
Isaiah Odhner 6276bd588c Highlight focused button or submit button in dialog windows
- Show the button that will be activated if you hit Enter with a special
  style. This is the focused button, if there is one, or else the submit
  button (usually the "OK" button.)
- Mark buttons with type="submit" or type="button". This may or may not
  prevent bad implicit Enter handling in some dialog(s).
- TODO: handle Enter in Edit Colors dialog; test everything
2023-02-13 20:27:03 -05:00
Isaiah Odhner e0ae75bd80 Focus width field by default in image attributes dialog
Fixes https://github.com/1j01/jspaint/issues/313
2023-02-13 03:31:23 -05:00
Isaiah Odhner 2dd66c36d3 Document individual system hooks and functions 2022-08-02 09:53:10 -04:00
Isaiah Odhner 65266a18ce Note inclusion in the API 2022-08-02 07:57:58 -04:00
Isaiah Odhner ccafef3445 Check for and fix problems in news articles
- Add missing target="_blank" attributes so links open externally
- Fix date format consistency
- Automate checking for issues
2022-08-01 17:52:29 -04:00
Isaiah Odhner 7a2bf5f4f4 Add news update: JS Paint is now Open Source! 2022-07-28 15:48:17 -04:00
Isaiah Odhner 85cffff321 Handle "exit menu" / "get outta here" 2022-02-25 11:26:26 -05:00
Isaiah Odhner 88ce57dff5 Fix activating menus with speech 2022-02-25 11:06:30 -05:00
Isaiah Odhner 25ee7513a7 Activate labels with speech recognition 2022-02-25 11:06:30 -05:00
Isaiah Odhner e304f8ae71 Add speech recognition alternatives for Select 2022-02-25 11:06:30 -05:00
Isaiah Odhner 87fcb55405 Add to speech recognition fixes list 2022-02-25 11:06:30 -05:00
Isaiah Odhner dfabe4041c Don't attempt dictation into non-textual inputs
- Dictating into a checkbox, for example, is nonsensical.
- Inputting into a color picker with voice is not supported.
- Inputting into number fields is not supported yet, although there is some very limited natural language number parsing for changing brush sizes.
2022-02-25 11:06:30 -05:00
Isaiah Odhner 714696e8c9 Improve global error handling resiliency 2022-02-24 21:14:20 -05:00
Isaiah Odhner e054b561c0 Add unhandledrejection handling 2022-02-24 20:43:46 -05:00
Isaiah Odhner 2141a67664 Fix Colors > Save Colors
Fixes #276
2022-02-24 20:28:12 -05:00
Isaiah Odhner ce8b7664e2 Fix error when shrinking selection with Numpad Subtract
Fixes #278
2022-02-24 17:50:32 -05:00
Isaiah Odhner 4a9163fb6d Format some last bits of code 2022-01-19 09:59:49 -05:00
Isaiah Odhner 5ff5f8b0c4 Adapt some modules less well because they have public state
These two modules were designed to handle cleanup upon repeated execution, i.e. via the JS Console, for development.
Simply changing `window` to `exports` here is a little weird, as it obscures this intent (without technically invalidating that aspect).
2022-01-19 00:17:32 -05:00
Isaiah Odhner a0e119ba8e Adapt some existing IIFEs to match 2022-01-19 00:17:32 -05:00
Isaiah Odhner 355fba3ee2 Wrap many modules in IIFEs to track their exports 2022-01-19 00:17:32 -05:00