-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c16: refactor: change term from rectangle to shape (#94)
- Loading branch information
1 parent
be64ae0
commit a44c675
Showing
12 changed files
with
86 additions
and
87 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
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
34 changes: 0 additions & 34 deletions
34
client/src/modules/pad-service/rectangle-input-service.context.ts
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
33 changes: 33 additions & 0 deletions
33
client/src/modules/pad-service/shape-input-service.context.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createContext, useContext } from 'react' | ||
import { Point } from '@/modules/common/geometry.types' | ||
|
||
export interface ShapeDrawEvent { | ||
point: Point | ||
isStart?: boolean | ||
isEnd?: boolean | ||
} | ||
|
||
/** | ||
* Facade/abstract for path input mechanisms | ||
*/ | ||
export interface ShapeInputService { | ||
emitDraw(event: ShapeDrawEvent): void | ||
} | ||
|
||
const ShapeInputServiceContext = createContext<ShapeInputService>({ | ||
emitDraw: () => { | ||
console.warn( | ||
'ShapeInput: emitDraw was called, but context was not provided' | ||
) | ||
}, | ||
}) | ||
|
||
/** | ||
* To be used at the ancestor level. | ||
* This will provide the implementation of `PathInputService` | ||
*/ | ||
export const ShapeInputServiceProvider = ShapeInputServiceContext.Provider | ||
|
||
export function useShapeInputService() { | ||
return useContext(ShapeInputServiceContext) | ||
} |
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
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.