Giter Site home page Giter Site logo

gthmb / jquery-free-transform Goto Github PK

View Code? Open in Web Editor NEW
134.0 134.0 58.0 363 KB

provides simple controls that allows you to move/rotate/scale a DOM element. kinda like a simple version of the free transform tool in Flash or Photoshop.

CSS 1.55% JavaScript 95.89% HTML 2.56%

jquery-free-transform's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery-free-transform's Issues

prevent error

function _setOptions(data, opts) {
if (opts == null || opts == undefined) return;
delete opts._p;

ReferenceError: event is not defined

I get that error report from firebug and this is the line.

It said it is on line 7.
I call the this plugin function after some events like click and drag was initiated!

Method "update" is required.

Elements may be changed by other scripts, in this case needed some UPDATE method which will update position and size of contols boxes;

Set values from matrix string?

I really like your library, it's exactly what I need. However, it would be nice to be able to set the attributes from a css-like string, without having to fiddle about with matrices externally. I mean sth. like this:

$('mydiv').freetrans({
transform: "matrix(2, 0, 0, 2, 0, 0)"
});

Is that possible?

Callback functions

Are there any callback functions to listen on, like drag/scale/rotate-stop?

Controls on wrong position

Hi, when i manualy rotate the object and then change it's rotation with script ( for example with button onlick) the points in corners goes to wrong position.
You can test it here
http://jsfiddle.net/xUtq6/
just manualy rotate the cat and than click on the button...

Enhancement

Just for fun I've forked and enhanced your jsfiddle a little bit: http://jsfiddle.net/98hGA/4/

Now you the appropriate cursors shows up depending on what little box you are hovering over before resizing and grab/grabbing cursors show up for dragging.

Maintain aspect ratio option

Hello

I would like to know if it's possible to add an option for the resizing action to maintain aspect ratio (without having to press a key)

Thank you!

License?

I would love to use your library within a software package distributed under both GFDL and Creative Commons Attribution-ShareAlike (by-sa) License. As you do not have a license plate, I have to ask for your permission first.

Would it be ok to include, use and distribute in such a context?

Congratulations!

excellent plugin jonathan green, I have not seen anything like the web.
also wanted to ask you a question, how to make a "margin" element to the controls, I have not managed to do :( if you could help me would be very grateful.
 

Greetings from Chile

Image flipping

Hi,
I cant seem to force the flipping of an image as soon as freetransform function is running.
I'm trying to do that with CSS (scaleX(-1)), can anyone point me to a solution ?
Thanks

Scale from centre

It would be great to have the option to scale the element but maintain the central position.

What are x and y?

I'm hoping you can provide some clarity on the data object for me. scalex, scaley, and angle are clear enough, but I can't figure out what positions x and y are relative to. When the object isn't scaled or rotated, they give the position of the top left corner, but I'm not clear how the rotation and scale interact with them.

Ultimately, I'm trying to figure out how—given the properties from the plugin—I can recreate the transformation with the correct position.

Thanks!

containment?

Hello
i am using this nice feature, but i need to insert containment for drag & resize.
is it possible?

Ipad Gestures

Your library do everything I planned to create saving me tons of time.
I only needed to add the Ipad gestures(rotate/pinch).
I'm sending the code I added inside _init function, if you want to add/test it.

$(container).bind('gesturestart', function(evt) {

            evt.stopPropagation();

            var data = sel.data('freetrans'),
                cen = _getBounds(data._p.divs.controls).center,
                pressang = evt.originalEvent.rotation,
                startscale = evt.originalEvent.scale,
                tempScaleX = data.scalex,tempScaleY = data.scaley,
                firstAngle = true;

            rot = Number(data.angle);

            var change = _noSelect(function(evt) {

                if(firstAngle){
                    firstAngle=false;
                    if(Math.abs(evt.originalEvent.rotation)>30){
                        pressang = evt.originalEvent.rotation;
                    }
                }

                var ang = evt.originalEvent.rotation,
                    d = rot + ang - pressang,
                    newscale = evt.originalEvent.scale;

                data.angle = d;
                data._p.rad = d*rad;

                data.scalex = tempScaleX + newscale - startscale
                data.scaley = tempScaleY + newscale - startscale

                data._p.cwid = data._p.wid * data.scalex;
                data._p.chgt = data._p.hgt * data.scaley;

                _draw(sel, data);
            });

            var end = function(evt) {
                $(document).unbind('gesturechange.freetrans', change);
                $(document).unbind('gestureend.freetrans', end);
            };

            $(document).bind('gesturechange.freetrans', change);
            $(document).bind('gestureend.freetrans', end);
        });

SVG Elements Support

Hi,

Firstly thank you for taking the time to create this awesome script.
I have a quick question, Does it support free-transform for svg elements? I am working with svg.js for rendering and manipulating svg and looking for a transform tool for it.

Thanks,
Praney

Fix position for zoom!

I am trying to use this along with the jQuery Pan Zoom plugin. If the parent div is at a zoom other than 1 this free transform plugin doesn't perform as expected.

I got the same issue when using jQueryUI draggable with zoom but to fix it I used :

$(".selector").draggable({
drag: function(evt,ui)
{
var zoom = currentZoom; // current zoom value;

        ui.position.top = Math.round(ui.position.top / zoom);
        ui.position.left = Math.round(ui.position.left / zoom);
    }
});

How can I fix it with this plugin?
Can someone please help?

Thanks in Advance,
Praney

getBounds Documentation

In the readme, the following line:

var b = $('mydiv').getBounds();

should be:

var b = $('mydiv').freetrans('getBounds');

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.