-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related to bpmn-io/bpmn-js#1996
- Loading branch information
Showing
4 changed files
with
223 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Element } from '../../model/Types'; | ||
|
||
export type Outline = SVGSVGElement | SVGCircleElement | SVGRectElement; | ||
|
||
/** | ||
* An interface to be implemented by an outline provider. | ||
*/ | ||
export default interface OutlineProvider { | ||
|
||
/** | ||
* Returns an outline shape for the given element. | ||
* | ||
* @example | ||
* | ||
* ```javascript | ||
* getOutline(element) { | ||
* if(element.type === 'Foo') { | ||
* const outline = svgCreate('circle'); | ||
* | ||
* svgAttr(outline, { | ||
* cx: element.width / 2, | ||
* cy: element.height / 2, | ||
* r: 23 | ||
* }); | ||
* | ||
* return outline; | ||
* }; | ||
* } | ||
* ``` | ||
* | ||
* @param element | ||
*/ | ||
getOutline: (element: Element) => Outline; | ||
|
||
/** | ||
* Updates outline shape based on element's current size. Returns true if | ||
* update was handled by provider. | ||
* | ||
* @example | ||
* | ||
* ```javascript | ||
* updateOutline(element, outline) { | ||
* if(element.type === 'Foo') { | ||
* svgAttr(outline, { | ||
* cx: element.width / 2, | ||
* cy: element.height / 2, | ||
* r: 23 | ||
* }); | ||
* } else if(element.type === 'Bar') { | ||
* return true; | ||
* } | ||
* | ||
* return false; | ||
* } | ||
* ``` | ||
* | ||
* @param element | ||
* @param outline | ||
*/ | ||
updateOutline: (element: Element, outline: Outline) => boolean; | ||
} |
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