Ticket #11477: ticket11477parts13ver1.patch
File ticket11477parts13ver1.patch, 2.2 KB (added by miqrogroove, 5 years ago) 


imageedit.dev.js
299 299 }, 300 300 301 301 initCrop : function(postid, image, parent) { 302 var t = this, selW = $('#imgeditselwidth' + postid), 303 selH = $('#imgeditselheight' + postid); 302 var t = this; 304 303 305 304 t.iasapi = $(image).imgAreaSelect({ 306 305 parent: parent, … … 335 334 }, 336 335 337 336 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); 341 338 } 342 339 }); 343 340 }, 341 342 setSelectionInputValues : function(newwidth, newheight) { 343 var selW = $('#imgeditselwidth' + this.postid), 344 selH = $('#imgeditselheight' + this.postid), 345 sizer = this.hold.sizer; 344 346 347 selW.val( this.round(newwidth / sizer) ); 348 selH.val( this.round(newheight / sizer) ); 349 }, 350 345 351 setCropSelection : function(postid, c) { 346 352 var sel, min = $('#imgeditminthumb' + postid).val()  '128:128', 347 353 sizer = this.hold['sizer']; … … 535 541 }, 536 542 537 543 setRatioSelection : function(postid, n, el) { 538 var sel, r, x = this.intval( $('#imgeditcropwidth' + postid).val() ),544 var sel, r, x = parseFloat( $('#imgeditcropwidth' + postid).val() ), 539 545 y = this.intval( $('#imgeditcropheight' + postid).val() ), 540 546 h = $('#imagepreview' + postid).height(); 541 547 … … 550 556 }); 551 557 552 558 if ( sel = this.iasapi.getSelection(true) ) { 553 r = Math.ceil( sel.y1 + ((sel.x2  sel.x1) / (x / y)));559 newy2 = sel.y1 + Math.round((sel.x2  sel.x1) / (x / y)); 554 560 555 if ( r > h ) { 556 r = h; 557 if ( n ) 558 $('#imgeditcropheight' + postid).val(''); 559 else 560 $('#imgeditcropwidth' + postid).val(''); 561 if ( newy2 > h ) { 562 newy2 = h; 563 newx2 = sel.x1 + Math.round((newy2  sel.y1) * (x / y)); 564 } else { 565 newx2 = sel.x2; 561 566 } 562 567 563 this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r);568 this.iasapi.setSelection( sel.x1, sel.y1, newx2, newy2 ); 564 569 this.iasapi.update(); 570 this.setSelectionInputValues(newx2  sel.x1, newy2  sel.y1); 565 571 } 566 572 } 567 573 }