Add fill fill style. (#3966)

This PR adds a sneaky action / kbd (Alt-F) for the fill fill style.
Similar to the white action, this is not really documented and may be
removed in the future. But it's cool!!

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `feature` — New feature

### Test Plan

1. Press Alt-F.

### Release Notes

- Secretly adds a fill-fill style (Alt-F)
docs-2
Steve Ruiz 2024-06-18 11:50:01 +01:00 zatwierdzone przez GitHub
rodzic b60ae0f067
commit a307939822
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
5 zmienionych plików z 21 dodań i 2 usunięć

Wyświetl plik

@ -136,6 +136,7 @@
"fill-style.semi": "Semi",
"fill-style.solid": "Solid",
"fill-style.pattern": "Pattern",
"fill-style.fill": "Fill",
"dash-style.dashed": "Dashed",
"dash-style.dotted": "Dotted",
"dash-style.draw": "Draw",

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -1,6 +1,7 @@
import {
Box,
DefaultColorStyle,
DefaultFillStyle,
Editor,
HALF_PI,
PageRecordType,
@ -1355,11 +1356,26 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
editor.setStyleForSelectedShapes(style, 'white')
}
editor.setStyleForNextShapes(style, 'white')
editor.updateInstanceState({ isChangingStyle: true })
})
trackEvent('set-style', { source, id: style.id, value: 'white' })
},
},
{
id: 'select-fill-fill',
label: 'fill-style.fill',
kbd: '?f',
onSelect(source) {
const style = DefaultFillStyle
editor.batch(() => {
editor.mark('change-fill')
if (editor.isIn('select')) {
editor.setStyleForSelectedShapes(style, 'fill')
}
editor.setStyleForNextShapes(style, 'fill')
})
trackEvent('set-style', { source, id: style.id, value: 'fill' })
},
},
{
id: 'flatten-to-image',
label: 'action.flatten-to-image',

Wyświetl plik

@ -140,6 +140,7 @@ export type TLUiTranslationKey =
| 'fill-style.semi'
| 'fill-style.solid'
| 'fill-style.pattern'
| 'fill-style.fill'
| 'dash-style.dashed'
| 'dash-style.dotted'
| 'dash-style.draw'

Wyświetl plik

@ -140,6 +140,7 @@ export const DEFAULT_TRANSLATION = {
'fill-style.semi': 'Semi',
'fill-style.solid': 'Solid',
'fill-style.pattern': 'Pattern',
'fill-style.fill': 'Fill',
'dash-style.dashed': 'Dashed',
'dash-style.dotted': 'Dotted',
'dash-style.draw': 'Draw',