wp/wp-includes/js/jquery/ui/selectable.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     1 /*!
     1 /*!
     2  * jQuery UI Selectable 1.12.1
     2  * jQuery UI Selectable 1.13.1
     3  * http://jqueryui.com
     3  * http://jqueryui.com
     4  *
     4  *
     5  * Copyright jQuery Foundation and other contributors
     5  * Copyright jQuery Foundation and other contributors
     6  * Released under the MIT license.
     6  * Released under the MIT license.
     7  * http://jquery.org/license
     7  * http://jquery.org/license
    13 //>>docs: http://api.jqueryui.com/selectable/
    13 //>>docs: http://api.jqueryui.com/selectable/
    14 //>>demos: http://jqueryui.com/selectable/
    14 //>>demos: http://jqueryui.com/selectable/
    15 //>>css.structure: ../../themes/base/selectable.css
    15 //>>css.structure: ../../themes/base/selectable.css
    16 
    16 
    17 ( function( factory ) {
    17 ( function( factory ) {
       
    18 	"use strict";
       
    19 
    18 	if ( typeof define === "function" && define.amd ) {
    20 	if ( typeof define === "function" && define.amd ) {
    19 
    21 
    20 		// AMD. Register as an anonymous module.
    22 		// AMD. Register as an anonymous module.
    21 		define( [
    23 		define( [
    22 			"jquery",
    24 			"jquery",
    26 	} else {
    28 	} else {
    27 
    29 
    28 		// Browser globals
    30 		// Browser globals
    29 		factory( jQuery );
    31 		factory( jQuery );
    30 	}
    32 	}
    31 }( function( $ ) {
    33 } )( function( $ ) {
       
    34 "use strict";
    32 
    35 
    33 return $.widget( "ui.selectable", $.ui.mouse, {
    36 return $.widget( "ui.selectable", $.ui.mouse, {
    34 	version: "1.12.1",
    37 	version: "1.13.1",
    35 	options: {
    38 	options: {
    36 		appendTo: "body",
    39 		appendTo: "body",
    37 		autoRefresh: true,
    40 		autoRefresh: true,
    38 		distance: 0,
    41 		distance: 0,
    39 		filter: "*",
    42 		filter: "*",
   180 			x1 = this.opos[ 0 ],
   183 			x1 = this.opos[ 0 ],
   181 			y1 = this.opos[ 1 ],
   184 			y1 = this.opos[ 1 ],
   182 			x2 = event.pageX,
   185 			x2 = event.pageX,
   183 			y2 = event.pageY;
   186 			y2 = event.pageY;
   184 
   187 
   185 		if ( x1 > x2 ) { tmp = x2; x2 = x1; x1 = tmp; }
   188 		if ( x1 > x2 ) {
   186 		if ( y1 > y2 ) { tmp = y2; y2 = y1; y1 = tmp; }
   189 			tmp = x2; x2 = x1; x1 = tmp;
       
   190 		}
       
   191 		if ( y1 > y2 ) {
       
   192 			tmp = y2; y2 = y1; y1 = tmp;
       
   193 		}
   187 		this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
   194 		this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
   188 
   195 
   189 		this.selectees.each( function() {
   196 		this.selectees.each( function() {
   190 			var selectee = $.data( this, "selectable-item" ),
   197 			var selectee = $.data( this, "selectable-item" ),
   191 				hit = false,
   198 				hit = false,
   201 			offset.top    = selectee.top    + that.elementPos.top;
   208 			offset.top    = selectee.top    + that.elementPos.top;
   202 			offset.bottom = selectee.bottom + that.elementPos.top;
   209 			offset.bottom = selectee.bottom + that.elementPos.top;
   203 
   210 
   204 			if ( options.tolerance === "touch" ) {
   211 			if ( options.tolerance === "touch" ) {
   205 				hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
   212 				hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
   206                     offset.bottom < y1 ) );
   213 					offset.bottom < y1 ) );
   207 			} else if ( options.tolerance === "fit" ) {
   214 			} else if ( options.tolerance === "fit" ) {
   208 				hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
   215 				hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
   209                     offset.bottom < y2 );
   216 					offset.bottom < y2 );
   210 			}
   217 			}
   211 
   218 
   212 			if ( hit ) {
   219 			if ( hit ) {
   213 
   220 
   214 				// SELECT
   221 				// SELECT
   304 		return false;
   311 		return false;
   305 	}
   312 	}
   306 
   313 
   307 } );
   314 } );
   308 
   315 
   309 } ) );
   316 } );