[wp-trac] [WordPress Trac] #42646: Customizer cropped images issue with flex-width=false and flex-height=false

WordPress Trac noreply at wordpress.org
Thu Jan 18 01:05:17 UTC 2018


#42646: Customizer cropped images issue with flex-width=false and flex-height=false
-------------------------------------------------+-------------------------
 Reporter:  WebTrooper                           |       Owner:
     Type:  defect (bug)                         |  adamsilverstein
 Priority:  normal                               |      Status:  assigned
Component:  Customize                            |   Milestone:  4.9.3
 Severity:  normal                               |     Version:  4.9
 Keywords:  has-patch has-screenshots needs-     |  Resolution:
  testing                                        |     Focuses:  javascript
-------------------------------------------------+-------------------------

Comment (by WebTrooper):

 The following is my exact changes to /wp-includes/js/media-views.js
 Nothing has changed. The only thing I can't do is drag the bottom crop
 handle downward, but otherwise I can freely move the handles and crop
 without respect to aspect ratios. Here's a video -
 https://youtu.be/XBNMmlf1X1k


 {{{
                 imgOptions = _.extend(imgOptions, {
                         parent: this.$el,
                         onInit: function() {
                                 // this.parent.children().on( 'mousedown
 touchstart', function( e ){

                                 //      if ( e.shiftKey ) {
            // Store the set ratio.
         var setRatio = imgSelect.getOptions().aspectRatio;

         // On mousedown, If no ratio is set and the shift key is down,
 used a 1:1 ratio.
         this.parent.children().on( 'mousedown touchstart', function( e ) {

                 // If no ratio is set and the shift key is down, used a
 1:1 ratio.
                 if ( ! setRatio && e.shiftKey ) {
                                                 imgSelect.setOptions( {
                                                         aspectRatio: '1:1'
                                                 } );
                                         // } else {
                                         //      imgSelect.setOptions( {
                                         //              aspectRatio: false
                                         //      } );
                                         }
                                 } );

            this.parent.children().on( 'mouseup touchend', function( e ) {

                    // Restore the set ratio.
                    imgSelect.setOptions( {
                            aspectRatio: setRatio ? setRatio : false
                    } );
            } );
                         }
                 } );
                 this.trigger('image-loaded');

 }}}


 And here is my theme settings

 {{{
 function bc_twentyseventeen_custom_header_setup() {

         remove_theme_support( 'custom-header');

         add_theme_support( 'custom-header', apply_filters(
 'twentyseventeen_custom_header_args', array(
                 'default-image'      => get_parent_theme_file_uri(
 '/assets/images/header.jpg' ),
                 'width'              => 2000,
                 'height'             => 1200,
                 'flex-height'        => false,
                 'flex-width'         => false,
                 'video'              => true,
                 'wp-head-callback'   => 'twentyseventeen_header_style',
         ) ) );

 }
 add_action( 'after_setup_theme', 'bc_twentyseventeen_custom_header_setup',
 11 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42646#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list