Coder Social home page Coder Social logo

angular-crop's Introduction

Angular-crop

Angular directive that brings jCrop into Angular.

Table of Contents generated with DocToc

Installing

Currently WIP, will be published to bower soon.

Usage

First of all, add angular-crop as dependency to your existing application by doing the following:

var yourModule = angular.module("yourModule", ['angular-crop']);

Next, apply angular-crop directive on any <img> element inside your template, like so:

<img ng-src="{{ imageUrl }}" angular-crop></div>

Configuration

Settings

All the attributes specified by jcrop docs are available.

For further explanation please refer to its documentation here.

Events

Same as above.

  • Following callbacks are available:
    • onChange - called on every crop change
    • onRelease - called on focus out when cropping is finished
    • onSelect - called when cropping has stopped but area is still focused

Callbacks should be passed as e.g. data-on-change="myScopeOnChangeMethod". Every callback receives coordinates argument that looks like below:

{
    h: 149
    w: 187
    x: 201
    x2: 388
    y: 52
    y2: 201
}

Contributing

This repository uses Airbnb javascript style guide along with jscs tests to make sure all the requirements are fulfilled. Before doing a pull request, please double check your code.

Legacy notes

Licence

As original repository has been licensed under GPL license and that was changed here to MIT, the whole project has been rewritten from scratch to avoid any legacy issues that may occur in the future. Although to appreciate original author efforts and in order to say thank you for inspiration he gave me I've decided to fork his repository instead of creating a new one.

History

As original repository seems to be abandoned, the purpose of this fork is to carry on further development to allow easy usage of JCrop in other projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.