-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(draw): support vector pen #WIK-15919
- Loading branch information
Showing
32 changed files
with
718 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@plait/draw': minor | ||
--- | ||
|
||
support vector pen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
...generators/arrow-line-active.generator.ts → ...w/src/generators/line-active.generator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { PlaitDrawElement } from '../interfaces'; | ||
import { Generator } from '@plait/common'; | ||
import { drawArrowLine } from '../utils/arrow-line/arrow-line-basic'; | ||
import { PlaitLine } from '../interfaces/line'; | ||
import { drawVectorLine } from '../utils'; | ||
|
||
export interface ShapeData {} | ||
|
||
export class LineGenerator extends Generator<PlaitLine, ShapeData> { | ||
canDraw(element: PlaitLine, data: ShapeData): boolean { | ||
return true; | ||
} | ||
|
||
draw(element: PlaitLine, data: ShapeData) { | ||
let lineG: SVGGElement | undefined; | ||
if (PlaitDrawElement.isArrowLine(element)) { | ||
lineG = drawArrowLine(this.board, element); | ||
} | ||
if (PlaitDrawElement.isVectorLine(element)) { | ||
lineG = drawVectorLine(this.board, element); | ||
} | ||
return lineG; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { PlaitArrowLine } from './arrow-line'; | ||
import { PlaitVectorLine } from './vector-line'; | ||
|
||
export type PlaitLine = PlaitArrowLine | PlaitVectorLine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.