Skip to content

Commit

Permalink
feat: 增加线条样式
Browse files Browse the repository at this point in the history
  • Loading branch information
JessYan0913 committed Aug 25, 2023
1 parent e55e9ee commit 0500e7b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
15 changes: 15 additions & 0 deletions main/src/assets/images/dotted-line-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions main/src/assets/images/dotted-line-2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion main/src/form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface RadioGroupConfig extends FormItem {
type: 'RadioGroup';
optionType?: 'text' | 'icon';
options: {
value: string | number | boolean;
value: string | number | boolean | Array<string | number | boolean>;
label: string;
class?: string;
}[];
Expand Down
21 changes: 21 additions & 0 deletions main/src/panels/line-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ export const linePanelConfig: PanelConfig = {
},
],
},
{
name: 'dash',
label: '边框样式',
type: 'RadioGroup',
optionType: 'icon',
options: [
{
label: 'line-1',
value: [],
},
{
label: 'dotted-line-2',
value: [10, 8],
},
{
label: 'dotted-line-1',
value: [6, 4],
},
],
},
{
name: 'opacity',
label: '透明度',
Expand All @@ -56,6 +76,7 @@ export const linePanelConfig: PanelConfig = {
strokeWidth: 2,
opacity: 1,
tension: 0.4,
dash: [],
},
};

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/polyfill/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Konva.Rect.prototype.toObject = function (): any {
attrs: {
...object.attrs,
strokeWidth: this.strokeWidth(),
dash: this.dash(),
},
};
};
Expand All @@ -34,6 +35,7 @@ Konva.Ellipse.prototype.toObject = function (): any {
attrs: {
...object.attrs,
strokeWidth: this.strokeWidth(),
dash: this.dash(),
},
};
};
Expand All @@ -45,6 +47,7 @@ Konva.RegularPolygon.prototype.toObject = function (): any {
attrs: {
...object.attrs,
strokeWidth: this.strokeWidth(),
dash: this.dash(),
},
};
};
Expand All @@ -56,6 +59,7 @@ Konva.Line.prototype.toObject = function (): any {
attrs: {
...object.attrs,
strokeWidth: this.strokeWidth(),
dash: this.dash(),
},
};
};
Expand Down

0 comments on commit 0500e7b

Please sign in to comment.