delkant / angular-areas

Angular Directive ( ng-areas ) that let you select and manipulate multiple areas on an image, create, edit, move them and resize them too.
MIT License
25 stars 11 forks source link

angular-areas

Angular Directive ( ng-areas ) that let you select and manipulate multiple areas on an image, create, edit, move and resize them too.

Quick Start

Install with Bower

$ bower install angular-areas

Use like so:

    <div ng-controller="DemoController">
        <img ng-areas="areasArray" ng-areas-width="900"
            ng-areas-allow="{'edit':true, 'move':true, 'resize':true, 'select':true, 'remove':true, 'nudge':false}"
            ng-areas-on-add="onAddArea"
            ng-areas-on-remove="onRemoveArea"
            ng-areas-on-change="onChangeAreas900"
            ng-areas-extend-data="{pageNumber: 1, tag: 'img900px'}"
            ng-src="https://github.com/delkant/angular-areas/raw/master/aImage.jpg">
    </div>

DEMO and example to learn from.

Check out the DEMO

Browser Compatibiilty:

This plugin is fully compatible with every modern browser and IE >= 9.

API Doc

Area

An area is described (when retrieved or set) by a json object:

    {
        x,  // X coordinate (Position)
        y,  // Y coordinate (Position)
        z,  // Z-index (0 when inactive or 100 when focused)
        width,  // Width of the area (Size)
        height  // Height of the area (Size)
    }

Options and parameters

Here is a list of available options for selectAreas, with their default value:

Events handlers

Three events are fired by the plugin:

Event listeners / subscribers

So far one event is listening by the plugin:

LICENSE

    MIT

Inspired by https://github.com/360Learning/jquery-select-areas