Make WordPress Core

Ticket #11477: ticket-11477-part2-ver1.patch

File ticket-11477-part2-ver1.patch, 855 bytes (added by miqrogroove, 15 years ago)

Take the handcuffs off of the Aspect ratio fields. Fixes points 4 through 5 out of 19. Variable naming affects part1.

  • image-edit.dev.js

     
    550550                        });
    551551
    552552                        if ( sel = this.iasapi.getSelection(true) ) {
    553                                 r = Math.ceil( sel.y1 + ((sel.x2 - sel.x1) / (x / y)) );
     553                                newy2 = sel.y1 + Math.round((sel.x2 - sel.x1) / (x / y));
    554554
    555                                 if ( r > h ) {
    556                                         r = h;
    557                                         if ( n )
    558                                                 $('#imgedit-crop-height-' + postid).val('');
    559                                         else
    560                                                 $('#imgedit-crop-width-' + postid).val('');
     555                                if ( newy2 > h ) {
     556                                        newy2 = h;
     557                                        newx2 = sel.x1 + Math.round((newy2 - sel.y1) * (x / y));
     558                                } else {
     559                                        newx2 = sel.x2;
    561560                                }
    562561
    563                                 this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r );
     562                                this.iasapi.setSelection( sel.x1, sel.y1, newx2, newy2 );
    564563                                this.iasapi.update();
    565564                        }
    566565                }