-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract watermark into TextWatermark primitive plugin
- Loading branch information
1 parent
da7ae7c
commit c5a8409
Showing
25 changed files
with
637 additions
and
438 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
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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { defaultFontFamily } from '../../helpers/make-font'; | ||
|
||
import { HorzAlign, VertAlign } from '../types'; | ||
|
||
export interface TextWatermarkOptions { | ||
/** | ||
* Display the watermark. | ||
* | ||
* @defaultValue `true` | ||
*/ | ||
visible: boolean; | ||
|
||
/** | ||
* Horizontal alignment inside the chart area. | ||
* | ||
* @defaultValue `'center'` | ||
*/ | ||
horzAlign: HorzAlign; | ||
|
||
/** | ||
* Vertical alignment inside the chart area. | ||
* | ||
* @defaultValue `'center'` | ||
*/ | ||
vertAlign: VertAlign; | ||
|
||
/** | ||
* Text to be displayed within the watermark. Each item | ||
* in the array is treated as new line. | ||
* | ||
* @defaultValue `[]` | ||
*/ | ||
lines: TextWatermarkLineOptions[]; | ||
} | ||
|
||
export interface TextWatermarkLineOptions { | ||
/** | ||
* Watermark color. | ||
* | ||
* @defaultValue `'rgba(0, 0, 0, 0.5)'` | ||
*/ | ||
|
||
color: string; | ||
/** | ||
* Text of the watermark. Word wrapping is not supported. | ||
* | ||
* @defaultValue `''` | ||
*/ | ||
text: string; | ||
|
||
/** | ||
* Font size in pixels. | ||
* | ||
* @defaultValue `48` | ||
*/ | ||
fontSize: number; | ||
|
||
/** | ||
* Line height in pixels. | ||
* | ||
* @defaultValue `1.2 * fontSize` | ||
*/ | ||
lineHeight?: number; | ||
|
||
/** | ||
* Font family. | ||
* | ||
* @defaultValue `-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif` | ||
*/ | ||
fontFamily: string; | ||
|
||
/** | ||
* Font style. | ||
* | ||
* @defaultValue `''` | ||
*/ | ||
fontStyle: string; | ||
} | ||
|
||
export const textWatermarkOptionsDefaults: TextWatermarkOptions = { | ||
visible: true, | ||
horzAlign: 'center', | ||
vertAlign: 'center', | ||
lines: [], | ||
}; | ||
|
||
export const textWatermarkLineOptionsDefaults: TextWatermarkLineOptions = { | ||
color: 'rgba(0, 0, 0, 0.5)', | ||
fontSize: 48, | ||
fontFamily: defaultFontFamily, | ||
fontStyle: '', | ||
text: '', | ||
}; |
Oops, something went wrong.