0.1.0 • Published 3 years ago

ember-rough-notation v0.1.0

Weekly downloads
86
License
MIT
Repository
github
Last release
3 years ago

ember-rough-notation

An Ember wrapper for RoughNotation, a small Javascript library to create and animate annotations on a web page.

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Installation

ember install ember-rough-notation

Usage

Rough-Notation Component

This is the main component for using an annotation.

Examples

{{!-- Inline component --}}
<Rough-Notation @type="underline" @show={{true}} @text="Lorem Ipsum" />

{{!-- Block Notation --}}
<Rough-Notation @type="underline" @show={{true}}>
    Lorem Ipsum
</Rough-Notation>

Properties

NameTypeDefaultDescription
typestringunderlineThis is a mandatory field. It sets the annotation style. Options are underline, box, circle, highlight, strike-through, crossed-off
showbooleanfalseShow/hide the annotation
grouparrayan array of annotations maintained by the Rough-Notation-Group component
textstringThe text to be rendered inside the component if no block content exists
animatebooleantrueBoolean property to turn on/off animation when annotating
animationDurationint800Duration of the animation in milliseconds
animationDelaynumber0Delay in animation in milliseconds.
colorstringcurrentColorString value representing the color of the annotation sketch
strokeWidthint1Width of the annotation strokes
paddingint5Padding between the element and roughly where the annotation is drawn
iterationsint2By 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

Rough-Notation-Group

Multiple annotations can be grouped together and the animations triggered in order by using a group component. It yields a group array that can be passed to Rough-Notation components.

Examples

<Rough-Notation-Group @show={{true}} as |group|>
    <p>
        Lorem ipsum dolor sit amet,
        <Rough-Notation @group={{group}} @text="consectetur adipiscing" /> elit.
        Donec condimentum nibh eleifend, egestas orci a, vulputate lorem.
        <Rough-Notation @group={{group}} @text="Fusce ornare" /> molestie ipsum sed tincidunt.
    </p>
</Rough-Notation-Group>

Properties

NameTypeDefaultDescription
showbooleanfalseShow/hide the annotation

Annotate Modifier

If you don't need a lot of control over an annotation after initial render, the {{annote}} modifier is a good lighweight option.

Examples

<p>
    <span {{annotate (hash type="box" color="red")}}>Lorem ipsum</span> dolor sit amet, consectetur adipiscing elit.
    Donec condimentum nibh eleifend, egestas orci a, vulputate lorem.
    <span {{annotate (hash type="underline")}}>Fusce ornare</span> molestie ipsum sed tincidunt.
<p>

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.