Skip to content

Commit eaff15a

Browse files
authored
Merge pull request #5 from Leecason/feature/bracket
Feature: bracket type
2 parents ffefdaf + 46e2b93 commit eaff15a

File tree

6 files changed

+37
-33
lines changed

6 files changed

+37
-33
lines changed

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ The default global options are:
6060
animate: true,
6161
// Duration of the animation in milliseconds.
6262
animationDuration: 800,
63-
// Delay in animation in milliseconds.
64-
animationDelay: 0,
6563
// Representing the color of the annotation sketch.
6664
color: 'currentColor',
6765
// Width of the annotation strokes.
@@ -72,6 +70,8 @@ The default global options are:
7270
multiline: false,
7371
// By default annotations are drawn in two iterations.
7472
iterations: 2,
73+
// When drawing a bracket, this configures which side(s) of the element to bracket.
74+
brackets: `right`,
7575
}
7676
```
7777

@@ -106,12 +106,13 @@ Vue.use(VueRoughNotation, options);
106106

107107
This is a mandatory field. It sets the annotation style. Following are the list of supported annotation types:
108108

109-
- **underline**: Create a sketchy underline below an element.
109+
- **underline**: This style creates a sketchy underline below an element.
110110
- **box**: This style draws a box around the element.
111-
- **circle**: Draw a circle around the element.
112-
- **highlight**: Creates a highlight effect as if maked by a highlighter.
113-
- **strike-through**: This style draws a box around the element.
114-
- **crossed-off**: This style draws a box around the element.
111+
- **circle**: This style draws a circle around the element.
112+
- **highlight**: This style creates a highlight effect as if marked by a highlighter.
113+
- **strike-through**: This style draws horizontal lines through the element.
114+
- **crossed-off**: This style draws an 'X' across the element.
115+
- **bracket**: This style draws a bracket around an element, usually a paragraph of text. By default on the right side, but can be configured to any or all of left, right, top, bottom.
115116

116117
#### isShow
117118

@@ -143,16 +144,6 @@ Turn on/off animation when annotating.
143144

144145
Duration of the animation in milliseconds.
145146

146-
#### animationDelay
147-
148-
**Type**: `number`
149-
150-
**Required**: `false`
151-
152-
**Default**: `0` - You can change it when install _(see above)_.
153-
154-
Delay in animation in milliseconds.
155-
156147
#### color
157148

158149
**Type**: `string`
@@ -175,7 +166,7 @@ Width of the annotation strokes.
175166

176167
#### padding
177168

178-
**Type**: `number`
169+
**Type**: `number | number[]`
179170

180171
**Required**: `false`
181172

@@ -203,6 +194,16 @@ This property only applies to inline text. To annotate multiline text (each line
203194

204195
By default annotations are drawn in two iterations, e.g. when underlining, drawing from left to right and then back from right to left. Setting this property can let you configure the number of iterations.
205196

197+
#### brackets
198+
199+
**Type**: `string | string[]`
200+
201+
**Required**: `false`
202+
203+
**Default**: `'right'`
204+
205+
Value could be a string or an array of strings, each string being one of these values: **left**, **right**, **top**, **bottom**. When drawing a bracket, this configures which side(s) of the element to bracket. Default value is `right`.
206+
206207
#### tag
207208

208209
**Type**: `string`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"license": "MIT",
4141
"dependencies": {
42-
"rough-notation": "^0.3.3"
42+
"rough-notation": "^0.4.0"
4343
},
4444
"devDependencies": {
4545
"@babel/core": "^7.10.1",

src/components/RoughNotation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const AVAILABLE_TYPES = [
77
'highlight',
88
'strike-through',
99
'crossed-off',
10+
'bracket',
1011
];
1112

1213
export default (options) => ({
@@ -41,11 +42,6 @@ export default (options) => ({
4142
default: () => options.animationDuration,
4243
},
4344

44-
animationDelay: {
45-
type: Number,
46-
default: () => options.animationDelay,
47-
},
48-
4945
color: {
5046
type: String,
5147
default: () => options.color,
@@ -71,6 +67,11 @@ export default (options) => ({
7167
default: () => options.iterations,
7268
},
7369

70+
brackets: {
71+
type: [String, Array],
72+
default: () => options.brackets,
73+
},
74+
7475
order: {
7576
type: [Number, String],
7677
default: 0,
@@ -82,7 +83,6 @@ export default (options) => ({
8283
type: this.type,
8384
animate: this.animate,
8485
animationDuration: this.animationDuration,
85-
animationDelay: this.animationDelay,
8686
color: this.color,
8787
strokeWidth: this.strokeWidth,
8888
padding: this.padding,

src/options.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ export const defaultOptions = {
33
animate: true,
44
// Duration of the animation in milliseconds.
55
animationDuration: 800,
6-
// Delay in animation in milliseconds.
7-
animationDelay: 0,
86
// Representing the color of the annotation sketch.
97
color: 'currentColor',
108
// Width of the annotation strokes.
@@ -20,4 +18,8 @@ export const defaultOptions = {
2018
// e.g.when underlining, drawing from left to right and then back from right to left.
2119
// Setting this property can let you configure the number of iterations.
2220
iterations: 2,
21+
// Value could be a string or an array of strings,
22+
// each string being one of these values: left, right, top, bottom.
23+
// When drawing a bracket, this configures which side(s) of the element to bracket.
24+
brackets: 'right',
2325
};

types/VueRoughNotation.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { PluginObject } from "vue";
22

3-
export type RoughNotationTypes = 'underline' | 'box' | 'circle' | 'highlight' | 'strike-through' | 'crossed-off';
3+
export type RoughNotationTypes = 'underline' | 'box' | 'circle' | 'highlight' | 'strike-through' | 'crossed-off' | 'bracket';
44

55
export interface VueRoughNotationOptions {
66
animate?: boolean;
7-
animationDelay?: number;
87
color?: string;
98
strokeWidth?: number;
109
padding?: number;
10+
multiline?: boolean;
1111
iterations?: number;
12+
brackets?: string;
1213
}
1314

1415
export interface VueRoughNotationPluginObject extends PluginObject<VueRoughNotationOptions> {}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7656,10 +7656,10 @@ rollup@^2.11.2:
76567656
optionalDependencies:
76577657
fsevents "~2.1.2"
76587658

7659-
rough-notation@^0.3.3:
7660-
version "0.3.3"
7661-
resolved "https://registry.yarnpkg.com/rough-notation/-/rough-notation-0.3.3.tgz#abe82f464b3d5d990e6b2ccd11ca5e596b1b0d8e"
7662-
integrity sha512-u2wn53Re907g208tPOxNdlv3WYRaXmXxd7JNTbAzzrkG4/6Iw5ZdhdXol8/AiVreUgt3MiBWpPVt+SYJwkNkXQ==
7659+
rough-notation@^0.4.0:
7660+
version "0.4.0"
7661+
resolved "https://registry.yarnpkg.com/rough-notation/-/rough-notation-0.4.0.tgz#6f97324cb50fc91ec8064219253aa2528a69210f"
7662+
integrity sha512-hDgn9qMIxWnfY+WWjt30aLMtDHR13H8r/NI3EQNdJiEFAzpklH5nKg4eH/thpxCWTYzyg8ueMsKIfz9MzOBQ4Q==
76637663

76647664
rsvp@^4.8.4:
76657665
version "4.8.5"

0 commit comments

Comments
 (0)