Changeset 41557
- Timestamp:
- 09/21/2017 10:44:38 PM (7 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r41383 r41557 4524 4524 }, 4525 4525 onImageLoad: function() { 4526 var imgOptions = this.controller.get('imgSelectOptions'); 4526 var imgOptions = this.controller.get('imgSelectOptions'), 4527 imgSelect; 4528 4527 4529 if (typeof imgOptions === 'function') { 4528 4530 imgOptions = imgOptions(this.options.attachment, this.controller); 4529 4531 } 4530 4532 4531 imgOptions = _.extend(imgOptions, {parent: this.$el}); 4533 imgOptions = _.extend(imgOptions, { 4534 parent: this.$el, 4535 onInit: function() { 4536 this.parent.children().on( 'mousedown touchstart', function( e ){ 4537 4538 if ( e.shiftKey ) { 4539 imgSelect.setOptions( { 4540 aspectRatio: '1:1' 4541 } ); 4542 } else { 4543 imgSelect.setOptions( { 4544 aspectRatio: false 4545 } ); 4546 } 4547 } ); 4548 } 4549 } ); 4532 4550 this.trigger('image-loaded'); 4533 this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions);4551 imgSelect = this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); 4534 4552 }, 4535 4553 onError: function() { -
trunk/src/wp-includes/js/media/views/cropper.js
r41351 r41557 46 46 }, 47 47 onImageLoad: function() { 48 var imgOptions = this.controller.get('imgSelectOptions'); 48 var imgOptions = this.controller.get('imgSelectOptions'), 49 imgSelect; 50 49 51 if (typeof imgOptions === 'function') { 50 52 imgOptions = imgOptions(this.options.attachment, this.controller); 51 53 } 52 54 53 imgOptions = _.extend(imgOptions, {parent: this.$el}); 55 imgOptions = _.extend(imgOptions, { 56 parent: this.$el, 57 onInit: function() { 58 this.parent.children().on( 'mousedown touchstart', function( e ){ 59 60 if ( e.shiftKey ) { 61 imgSelect.setOptions( { 62 aspectRatio: '1:1' 63 } ); 64 } else { 65 imgSelect.setOptions( { 66 aspectRatio: false 67 } ); 68 } 69 } ); 70 } 71 } ); 54 72 this.trigger('image-loaded'); 55 this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions);73 imgSelect = this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); 56 74 }, 57 75 onError: function() {
Note: See TracChangeset
for help on using the changeset viewer.