Make WordPress Core

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

File ticket-11477-part1-ver1.patch, 1.3 KB (added by miqrogroove, 15 years ago)

First, clean up some of the object oriented nonsense surrounding the iasapi implementation. Fixes points 1 through 3 out of 19.

  • image-edit.dev.js

     
    299299        },
    300300
    301301        initCrop : function(postid, image, parent) {
    302                 var t = this, selW = $('#imgedit-sel-width-' + postid),
    303                         selH = $('#imgedit-sel-height-' + postid);
     302                var t = this;
    304303
    305304                t.iasapi = $(image).imgAreaSelect({
    306305                        parent: parent,
     
    335334                        },
    336335
    337336                        onSelectChange: function(img, c) {
    338                                 var sizer = imageEdit.hold.sizer;
    339                                 selW.val( imageEdit.round(c.width / sizer) );
    340                                 selH.val( imageEdit.round(c.height / sizer) );
     337                                imageEdit.setSelectionInputValues(c.width, c.height);
    341338                        }
    342339                });
    343340        },
     341       
     342        setSelectionInputValues : function(newwidth, newheight) {
     343                var selW = $('#imgedit-sel-width-' + this.postid),
     344                        selH = $('#imgedit-sel-height-' + this.postid),
     345                        sizer = this.hold.sizer;
    344346
     347                selW.val( this.round(newwidth / sizer) );
     348                selH.val( this.round(newheight / sizer) );
     349        },
     350
    345351        setCropSelection : function(postid, c) {
    346352                var sel, min = $('#imgedit-minthumb-' + postid).val() || '128:128',
    347353                        sizer = this.hold['sizer'];
     
    562568
    563569                                this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r );
    564570                                this.iasapi.update();
     571                                this.setSelectionInputValues(sel.width, r - sel.y1);
    565572                        }
    566573                }
    567574        }