implement stroke style (#1571)

This commit is contained in:
David Luzar 2020-05-14 17:04:33 +02:00 committed by GitHub
parent f6be200388
commit 39c56a4c01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 459 additions and 9 deletions

View file

@ -227,6 +227,41 @@ export const actionChangeSloppiness = register({
),
});
export const actionChangeStrokeStyle = register({
name: "changeStrokeStyle",
perform: (elements, appState, value) => {
return {
elements: changeProperty(elements, appState, (el) =>
newElementWith(el, {
strokeStyle: value,
}),
),
appState: { ...appState, currentItemStrokeStyle: value },
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => (
<fieldset>
<legend>{t("labels.strokeStyle")}</legend>
<ButtonSelect
group="strokeStyle"
options={[
{ value: "solid", text: t("labels.strokeStyle_solid") },
{ value: "dashed", text: t("labels.strokeStyle_dashed") },
{ value: "dotted", text: t("labels.strokeStyle_dotted") },
]}
value={getFormValue(
elements,
appState,
(element) => element.strokeStyle,
appState.currentItemStrokeStyle,
)}
onChange={(value) => updateData(value)}
/>
</fieldset>
),
});
export const actionChangeOpacity = register({
name: "changeOpacity",
perform: (elements, appState, value) => {

View file

@ -30,6 +30,7 @@ export type ActionName =
| "changeFillStyle"
| "changeStrokeWidth"
| "changeSloppiness"
| "changeStrokeStyle"
| "changeOpacity"
| "changeFontSize"
| "toggleCanvasMenu"