Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Annotation Feature #1858

Merged
merged 78 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
408f8d7
Basic annoattion structure
ong6 Mar 20, 2022
698e984
Merge branch 'master' of https://github.com/MarkBind/markbind into an…
ong6 Mar 20, 2022
f9d46e2
basic working prototype
ong6 Mar 24, 2022
e2e3a06
Finished main functionality
ong6 Mar 27, 2022
625e7de
remove stuff from pic
ong6 Mar 27, 2022
de8b8e5
Fixed attribute processing
ong6 Mar 28, 2022
64983ac
Merge branch 'master' of https://github.com/MarkBind/markbind into an…
ong6 Mar 28, 2022
4bd1a79
temp changes
ong6 Apr 9, 2022
bb6a884
Merge branch 'master' of https://github.com/MarkBind/markbind into an…
ong6 Apr 9, 2022
9e6b7d4
Merge branch 'master' of https://github.com/MarkBind/markbind into an…
ong6 Apr 9, 2022
9bc3b05
temp change
ong6 Apr 10, 2022
4851c35
MVP for annotatepoint
ong6 Apr 11, 2022
edbf28e
removing temp files
ong6 Apr 11, 2022
b5bc052
added more attributes to annotatepoint
ong6 Apr 11, 2022
54eb6e2
refactoring work
ong6 Apr 11, 2022
39111c9
removed arrow implementation
ong6 Apr 11, 2022
0bef7b7
Bux fixes and updates
ong6 Apr 14, 2022
0e1becb
Fixed bugs and added more control
ong6 Apr 14, 2022
c3bb005
Merge branch 'master' of https://github.com/MarkBind/markbind into an…
ong6 Apr 14, 2022
a325d5b
fixed tests
ong6 Apr 14, 2022
4b50877
added more docs
ong6 Apr 14, 2022
c5dc1ca
improve reactivity, added more docs
ong6 Apr 16, 2022
16cf1b3
added more docs
ong6 Apr 16, 2022
34cad98
refactoring changes
ong6 Apr 16, 2022
499d7af
fixed large images not working with positioning
ong6 Apr 16, 2022
e845053
Merge branch 'master' of https://github.com/MarkBind/markbind into an…
ong6 Apr 16, 2022
1945abc
move to images and diagrams
ong6 Apr 17, 2022
3c11436
added sample image
ong6 Apr 17, 2022
ef525b8
update for responsiveness
ong6 Apr 17, 2022
cae447e
doc update
ong6 Apr 17, 2022
4200ea3
more documentation updates
ong6 Apr 17, 2022
6115b90
Update packages/vue-components/src/annotations/AnnotatePoint.vue
ong6 Apr 17, 2022
cfc994c
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
c6ac973
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
ff63ac0
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
4c0df91
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
9367365
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
4f3c686
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
01062f0
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
519771e
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
af880fe
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
5dabba1
Update docs/userGuide/syntax/annotations.md
ong6 Apr 17, 2022
7a18190
fix minor nits
ong6 Apr 17, 2022
ecdfc24
Merge branch 'annotation-feature' of https://github.com/ong6/markbind…
ong6 Apr 17, 2022
32d86ca
Standadize terms
ong6 Apr 17, 2022
aa50a43
fixed minor errors
ong6 Apr 17, 2022
cfe06c6
Added some text explaning the compute image method
ong6 Apr 17, 2022
0826808
fixed borken link
ong6 Apr 17, 2022
9a89c79
Other minor bug fixe
ong6 Apr 17, 2022
a8317d4
more feature improvements
ong6 Apr 18, 2022
6dddc9f
added cli tests
ong6 Apr 18, 2022
f024046
updated docs
ong6 Apr 18, 2022
87de069
fixed doc errors
ong6 Apr 18, 2022
78ea9da
Update docs/userGuide/syntax/annotations.md
ong6 Apr 18, 2022
18325ac
Merge branch 'annotation-feature' of https://github.com/ong6/markbind…
ong6 Apr 18, 2022
a5668a6
add one smaple use case
ong6 Apr 18, 2022
87504fb
Update docs/userGuide/syntax/annotations.md
ong6 Apr 18, 2022
2c3c340
Update docs/userGuide/syntax/annotations.md
ong6 Apr 18, 2022
cc30047
Update docs/userGuide/syntax/annotations.md
ong6 Apr 18, 2022
f278dad
fixed invalid links
ong6 Apr 18, 2022
9860640
Merge branch 'annotation-feature' of https://github.com/ong6/markbind…
ong6 Apr 18, 2022
5b89bfc
fixed examples
ong6 Apr 18, 2022
dacd26e
remove incorrect snapshots
ong6 Apr 18, 2022
11327a1
Update packages/vue-components/src/annotations/Annotate.vue
ong6 Apr 18, 2022
6328d64
Update packages/vue-components/src/annotations/AnnotatePoint.vue
ong6 Apr 18, 2022
a40ed07
remove whitespace
ong6 Apr 18, 2022
9993325
Merge branch 'annotation-feature' of https://github.com/ong6/markbind…
ong6 Apr 18, 2022
b1ea39b
Update docs/userGuide/syntax/annotations.md
ong6 Apr 19, 2022
00cde70
Update docs/userGuide/syntax/annotations.md
ong6 Apr 19, 2022
afd4677
Update docs/userGuide/syntax/annotations.md
ong6 Apr 19, 2022
ee5407c
grammer fix
ong6 Apr 19, 2022
961d966
fixed broken links
ong6 Apr 19, 2022
13ad72a
Update docs/userGuide/syntax/annotations.md
ong6 Apr 19, 2022
c4ac602
Update docs/userGuide/syntax/annotations.md
ong6 Apr 19, 2022
1945cbd
Update docs/userGuide/syntax/annotations.md
ong6 Apr 19, 2022
6e52766
add new trigger examples
ong6 Apr 19, 2022
14fe144
Merge branch 'annotation-feature' of https://github.com/ong6/markbind…
ong6 Apr 19, 2022
dbbb20e
wording
ong6 Apr 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added docs/images/annotateSampleImage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/userGuide/fullSyntaxReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
panels : ['Panels', ['presentation', 'reader-facing']],
tabs : ['Tabs', ['presentation', 'reader-facing']],
pictures : ['Pictures', ['images-diagrams', 'reader-facing']],
annotations : ['Annotations', ['images-diagrams', 'reader-facing']],
thumbnails : ['Thumbnails', ['images-diagrams', 'reader-facing']],
diagrams : ['Diagrams', ['images-diagrams', 'reader-facing']],
tree : ['Tree', ['images-diagrams', 'reader-facing']],
Expand Down
182 changes: 182 additions & 0 deletions docs/userGuide/syntax/annotations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{% from "userGuide/components/advanced.md" import slot_info_trigger %}

## Annotations

**An `annotate` component allows you to easily annotate over any images.**

Annotate wrappers (`<annotate>`) are used in conjunction with Annotate
Points (`<a-point>`).

- `<annotate>`: Annotate wrappers are used to hold the image and set its width and height.
- `<a-point>`: Annotate points define the position, text and style of each point within the image. Insert them between the Annotate wrappers.

The x and y coordinates of each Annotate Point are relative to the image and are written in percentage of total width or height.

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">

<annotate src="../../images/annotateSampleImage.png" width="500" alt="Sample Image">
<!-- Minimal Point -->
<a-point x="25%" y="25%" content="This point is 25% from the left and 25% from the top" />
<!-- Customize Point Size (default size is 40px) -->
<a-point x="50%" y="25%" content="This point is 50% from the left and 25% from the top" size="60"/>
<!-- Customize Point Header (default is empty) -->
<a-point x="75%" y="25%" content="This point is 75% from the left and 25% from the top" header="This has a header"/>
<!-- Customize Point Color (default color is green) -->
<a-point x="33%" y="50%" content="This point is 33% from the left and 50% from the top" color="red"/>
<!-- Customize Point Opacity (default opacity is 0.3) -->
<a-point x="66%" y="50%" content="This point is 66% from the left and 50% from the top" opacity="0.7"/>
<!-- Customize Point Label (default is empty) -->
<a-point x="25%" y="75%" content="This point is 25% from the left and 75% from the top" label="1"/>
<!-- Customize Text Color (default color is black) -->
<a-point x="50%" y="75%" content="This point is 50% from the left and 75% from the top" textColor="white" color="black" label="2" opacity="1"/>
<!-- Customize Font Size (default font size is 14) -->
<a-point x="75%" y="75%" content="This point is 75% from the left and 75% from the top" fontSize="30" label="3"/>
</annotate>
</variable>
</include>

**Using triggers for Annotate Point** <br>
ong6 marked this conversation as resolved.
Show resolved Hide resolved

Similar to **[popovers](../components/popups.md#popovers)**, Annotate Points also support different types of triggers and positions
for users with different needs.

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">

<annotate src="../../images/annotateSampleImage.png" width="500" alt="Sample Image">
<!-- Default Trigger (click)-->
<a-point x="33%" y="33%" content="Lorem ipsum dolor sit amet" />
<!-- Set Trigger to hover focus -->
<a-point x="66%" y="33%" content="Lorem ipsum dolor sit amet" trigger="hover focus"/>
<!-- Set Popover Placement (click)-->
<a-point x="25%" y="66%" content="Popover on the left" placement="left"/>
<a-point x="50%" y="66%" content="Popover on the bottom" placement="bottom"/>
<a-point x="75%" y="66%" content="Popover on the right" placement="right"/>
ong6 marked this conversation as resolved.
Show resolved Hide resolved
</annotate>
</variable>
</include>

<br>
ong6 marked this conversation as resolved.
Show resolved Hide resolved

**Displaying content as legends in Annotate Point**

`<a-point>` allows users to display its content inside a popover or as
a legend below the diagram or both. However, this only works if a label is
provided for the point.
ong6 marked this conversation as resolved.
Show resolved Hide resolved

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">

<annotate src="../../images/annotateSampleImage.png" width="500" alt="Sample Image">
<!-- Default Legend (popover only)-->
<a-point x="25%" y="50%" content="There is only text when you click me" label="1"/>
<!-- Set Legend to bottom only (popover is not clickable) -->
ong6 marked this conversation as resolved.
Show resolved Hide resolved
<a-point x="50%" y="50%" content="Clicking on this does nothing" label="2" legend="bottom" header="Headers are displayed as well"/>
<!-- Set Legend to both -->
<a-point x="75%" y="50%" content="There is text at both locations" label="3" legend="both" header="Headers are displayed at both positions"/>
</annotate>
</variable>
</include>

<br>

**Sample use cases for Annotate** <br>

Here we showcase some use cases of the Annotate feature.

**Example 1: Describing elements in an image** <br>

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">

<annotate src="https://markbind.org/userGuide/diagrams/object.png" height="500" alt="Sample Image">
<a-point x="6%" y="50%" content="You can use a triangle and a solid line (not to be confused with an arrow) to indicate class inheritance." label="1" header="Class inheritance" legend="both"/>
<a-point x="25.5%" y="50%" content="UML uses a solid diamond symbol to denote composition." label="2" header="Composition" color="red" legend="both"/>
<a-point x="45%" y="50%" content="UML uses a hollow diamond to indicate an aggregation." label="3" header="Aggregation" color="blue" legend="both"/>
<a-point x="64.5%" y="50%" content="Association labels describe the meaning of the association." label="4" header="Association labels" color="yellow" legend="both"/>
</annotate>
</variable>
</include>

**Example 2: Drawing over elements** <br>

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">

<annotate src="https://markbind.org/userGuide/diagrams/sequence.png" height="500" alt="Sample Image">
<a-point x="35%" y="18.5%" content="Operation is invoked" header="Operation" opacity="0.2" size="30"/>
<a-point x="65%" y="50%" content="This is the period during which the method is being executed" header="Activation Bar" opacity="0.3" size="50" color="yellow"/>
<a-point x="14%" y="85%" content="Return control and possibly some return value" header="Return Value" opacity="0.2" size="30" color="blue"/>
</annotate>
</variable>
</include>

<br>

****`<a-point>` Options****
ong6 marked this conversation as resolved.
Show resolved Hide resolved

| Name | Type | Default | Description |
| --------- | -------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| x | `String` | | **This must be specified.**<br>The x-coordinate of the point.<br>Supports range of values from `0%` to `100%`. |
| y | `String` | | **This must be specified.**<br>The y-coordinate of the point.<br>Supports range of values from `0%` to `100%`. |
| content | `String` | `''` | Annotate Point content.<br>The annotation content will be omitted if this is not provided. |
| header | `String` | `''` | Annotate Point header.<br>The header will be omitted if this is not provided. |
| trigger | `String` | `click` | Popover trigger type.<br>Supports: `click`, `focus`, `hover`, or any space-separated combination of these. |
| placement | `String` | `top` | Position of the Popover.<br>Supports: `top`, `left`, `right`, `bottom`. |
| label | `String` | `''` | The label shown on the point itself.<br>The label will be omitted if this is not provided.<br>Note that labels should not be too long as they might overflow out of the point. |
| size | `String` | `'40'` | The size of the point in pixels. |
| color | `String` | `'green'` | The color of the point.<br>Supports any color in the CSS color format. E.g. `red`, `#ffffff`, `rgb(66, 135, 245)`, etc. |
| opacity | `String` | `'0.3'` | The opacity of the point.<br>Supports range of values from `0` to `1`. |
| fontSize | `String` | `'14'` | The font size of the label.<br>Supports any pixel size smaller than size of the point. |
| textColor | `String` | `'black'` | The color of the label.<br>Supports any color in the CSS color format. E.g. `red`, `#ffffff`, `rgb(66, 135, 245)`, etc. |
| legend | `String` | `'popover'` | The position of the Annotate Point content and header.<br>Supports: `popover`, `bottom`, `both`. |

****`<annotate>` Options****

This is effectively the same as the options used for the [picture](#pictures) component.

| Name | Type | Default | Description |
| ------ | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| alt | `string` | | **This must be specified.**<br>The alternative text of the image. |
| src | `string` | | **This must be specified.**<br>The URL of the image.<br>The URL can be specified as absolute or relative references. More info in: _[Intra-Site Links]({{baseUrl}}/userGuide/formattingContents.html#intraSiteLinks)_ |
| height | `string` |`''`| The height of the image in pixels. |
| width | `string` |`''`| The width of the image in pixels.<br>If both width and height are specified, width takes priority over height. It is to maintain the image's aspect ratio. |
| eager | `boolean` | false | The `<pic>` component lazy loads its images by default.<br>If you want to eagerly load the images, simply specify this attribute. |

</div>

<div id="short" class="d-none">

```
<annotate src="../../images/annotateSampleImage.png" width="500" alt="Sample Image">
<a-point x="25%" y="25%" content="Lorem ipsum dolor sit amet" />
<a-point x="50%" y="25%" content="Lorem ipsum dolor sit amet" label="1a"/>
<a-point x="50%" y="25%" content="Lorem ipsum dolor sit amet" label="1b" legend="both"/>
</annotate>
```

</div>

<div id="examples" class="d-none">

<annotate src="https://markbind.org/userGuide/diagrams/object.png" height="500" alt="Sample Image">
<!-- Default Legend (popover only)-->
<a-point x="6%" y="50%" content="You can use a triangle and a solid line (not to be confused with an arrow) to indicate class inheritance." label="1" header="
Class inheritance"/>
<!-- Set Legend to bottom only (popover is not clickable) -->
<a-point x="25.5%" y="50%" content="UML uses a solid diamond symbol to denote composition." label="2" header="Composition" color="red"/>
<!-- Set Legend to both -->
<a-point x="45%" y="50%" content="UML uses a hollow diamond to indicate an aggregation." label="3" header="
Aggregation" color="blue"/>
<a-point x="64.5%" y="50%" content="Association labels describe the meaning of the association." label="4" header="Association labels" color="yellow"/>
</annotate>

</div>
</popover>
</div>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/cli/test/functional/test_site/expected/siteData.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@
},
"headingKeywords": {}
},
{
"src": "testAnnotate.md",
"title": "Annotate Feature Test",
"headings": {},
"headingKeywords": {}
},
{
"src": "testTooltipSpacing.md",
"title": "Tooltip Spacing Test",
Expand Down