| author | Anthony Ly <anthonyly.com@gmail.com> |
| Tue, 14 May 2013 18:17:07 +0200 | |
| changeset 1 | b95aebb070b5 |
| permissions | -rw-r--r-- |
|
1
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1 |
/*! |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2 |
* jQuery UI Resizable 1.10.3 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
3 |
* http://jqueryui.com |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
4 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
5 |
* Copyright 2013 jQuery Foundation and other contributors |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
6 |
* Released under the MIT license. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
7 |
* http://jquery.org/license |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
8 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
9 |
* http://api.jqueryui.com/resizable/ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
10 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
11 |
* Depends: |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
12 |
* jquery.ui.core.js |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
13 |
* jquery.ui.mouse.js |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
14 |
* jquery.ui.widget.js |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
15 |
*/ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
16 |
(function( $, undefined ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
17 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
18 |
function num(v) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
19 |
return parseInt(v, 10) || 0; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
20 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
21 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
22 |
function isNumber(value) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
23 |
return !isNaN(parseInt(value, 10)); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
24 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
25 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
26 |
$.widget("ui.resizable", $.ui.mouse, { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
27 |
version: "1.10.3", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
28 |
widgetEventPrefix: "resize", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
29 |
options: { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
30 |
alsoResize: false, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
31 |
animate: false, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
32 |
animateDuration: "slow", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
33 |
animateEasing: "swing", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
34 |
aspectRatio: false, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
35 |
autoHide: false, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
36 |
containment: false, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
37 |
ghost: false, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
38 |
grid: false, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
39 |
handles: "e,s,se", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
40 |
helper: false, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
41 |
maxHeight: null, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
42 |
maxWidth: null, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
43 |
minHeight: 10, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
44 |
minWidth: 10, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
45 |
// See #7960 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
46 |
zIndex: 90, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
47 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
48 |
// callbacks |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
49 |
resize: null, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
50 |
start: null, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
51 |
stop: null |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
52 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
53 |
_create: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
54 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
55 |
var n, i, handle, axis, hname, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
56 |
that = this, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
57 |
o = this.options; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
58 |
this.element.addClass("ui-resizable"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
59 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
60 |
$.extend(this, { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
61 |
_aspectRatio: !!(o.aspectRatio), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
62 |
aspectRatio: o.aspectRatio, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
63 |
originalElement: this.element, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
64 |
_proportionallyResizeElements: [], |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
65 |
_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
66 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
67 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
68 |
//Wrap the element if it cannot hold child nodes |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
69 |
if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
70 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
71 |
//Create a wrapper element and set the wrapper to the new current internal element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
72 |
this.element.wrap( |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
73 |
$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
74 |
position: this.element.css("position"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
75 |
width: this.element.outerWidth(), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
76 |
height: this.element.outerHeight(), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
77 |
top: this.element.css("top"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
78 |
left: this.element.css("left") |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
79 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
80 |
); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
81 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
82 |
//Overwrite the original this.element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
83 |
this.element = this.element.parent().data( |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
84 |
"ui-resizable", this.element.data("ui-resizable") |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
85 |
); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
86 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
87 |
this.elementIsWrapper = true; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
88 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
89 |
//Move margins to the wrapper |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
90 |
this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
91 |
this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
92 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
93 |
//Prevent Safari textarea resize |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
94 |
this.originalResizeStyle = this.originalElement.css("resize"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
95 |
this.originalElement.css("resize", "none"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
96 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
97 |
//Push the actual element to our proportionallyResize internal array |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
98 |
this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" })); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
99 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
100 |
// avoid IE jump (hard set the margin) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
101 |
this.originalElement.css({ margin: this.originalElement.css("margin") }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
102 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
103 |
// fix handlers offset |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
104 |
this._proportionallyResize(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
105 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
106 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
107 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
108 |
this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
109 |
if(this.handles.constructor === String) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
110 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
111 |
if ( this.handles === "all") { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
112 |
this.handles = "n,e,s,w,se,sw,ne,nw"; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
113 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
114 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
115 |
n = this.handles.split(","); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
116 |
this.handles = {}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
117 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
118 |
for(i = 0; i < n.length; i++) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
119 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
120 |
handle = $.trim(n[i]); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
121 |
hname = "ui-resizable-"+handle; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
122 |
axis = $("<div class='ui-resizable-handle " + hname + "'></div>"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
123 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
124 |
// Apply zIndex to all handles - see #7960 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
125 |
axis.css({ zIndex: o.zIndex }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
126 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
127 |
//TODO : What's going on here? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
128 |
if ("se" === handle) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
129 |
axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
130 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
131 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
132 |
//Insert into internal handles object and append to element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
133 |
this.handles[handle] = ".ui-resizable-"+handle; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
134 |
this.element.append(axis); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
135 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
136 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
137 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
138 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
139 |
this._renderAxis = function(target) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
140 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
141 |
var i, axis, padPos, padWrapper; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
142 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
143 |
target = target || this.element; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
144 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
145 |
for(i in this.handles) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
146 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
147 |
if(this.handles[i].constructor === String) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
148 |
this.handles[i] = $(this.handles[i], this.element).show(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
149 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
150 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
151 |
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
152 |
if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
153 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
154 |
axis = $(this.handles[i], this.element); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
155 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
156 |
//Checking the correct pad and border |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
157 |
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
158 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
159 |
//The padding type i have to apply... |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
160 |
padPos = [ "padding", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
161 |
/ne|nw|n/.test(i) ? "Top" : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
162 |
/se|sw|s/.test(i) ? "Bottom" : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
163 |
/^e$/.test(i) ? "Right" : "Left" ].join(""); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
164 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
165 |
target.css(padPos, padWrapper); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
166 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
167 |
this._proportionallyResize(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
168 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
169 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
170 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
171 |
//TODO: What's that good for? There's not anything to be executed left |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
172 |
if(!$(this.handles[i]).length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
173 |
continue; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
174 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
175 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
176 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
177 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
178 |
//TODO: make renderAxis a prototype function |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
179 |
this._renderAxis(this.element); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
180 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
181 |
this._handles = $(".ui-resizable-handle", this.element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
182 |
.disableSelection(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
183 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
184 |
//Matching axis name |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
185 |
this._handles.mouseover(function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
186 |
if (!that.resizing) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
187 |
if (this.className) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
188 |
axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
189 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
190 |
//Axis, default = se |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
191 |
that.axis = axis && axis[1] ? axis[1] : "se"; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
192 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
193 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
194 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
195 |
//If we want to auto hide the elements |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
196 |
if (o.autoHide) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
197 |
this._handles.hide(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
198 |
$(this.element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
199 |
.addClass("ui-resizable-autohide") |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
200 |
.mouseenter(function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
201 |
if (o.disabled) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
202 |
return; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
203 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
204 |
$(this).removeClass("ui-resizable-autohide"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
205 |
that._handles.show(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
206 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
207 |
.mouseleave(function(){ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
208 |
if (o.disabled) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
209 |
return; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
210 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
211 |
if (!that.resizing) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
212 |
$(this).addClass("ui-resizable-autohide"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
213 |
that._handles.hide(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
214 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
215 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
216 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
217 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
218 |
//Initialize the mouse interaction |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
219 |
this._mouseInit(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
220 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
221 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
222 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
223 |
_destroy: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
224 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
225 |
this._mouseDestroy(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
226 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
227 |
var wrapper, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
228 |
_destroy = function(exp) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
229 |
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
230 |
.removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
231 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
232 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
233 |
//TODO: Unwrap at same DOM position |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
234 |
if (this.elementIsWrapper) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
235 |
_destroy(this.element); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
236 |
wrapper = this.element; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
237 |
this.originalElement.css({ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
238 |
position: wrapper.css("position"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
239 |
width: wrapper.outerWidth(), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
240 |
height: wrapper.outerHeight(), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
241 |
top: wrapper.css("top"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
242 |
left: wrapper.css("left") |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
243 |
}).insertAfter( wrapper ); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
244 |
wrapper.remove(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
245 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
246 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
247 |
this.originalElement.css("resize", this.originalResizeStyle); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
248 |
_destroy(this.originalElement); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
249 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
250 |
return this; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
251 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
252 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
253 |
_mouseCapture: function(event) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
254 |
var i, handle, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
255 |
capture = false; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
256 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
257 |
for (i in this.handles) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
258 |
handle = $(this.handles[i])[0]; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
259 |
if (handle === event.target || $.contains(handle, event.target)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
260 |
capture = true; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
261 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
262 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
263 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
264 |
return !this.options.disabled && capture; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
265 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
266 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
267 |
_mouseStart: function(event) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
268 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
269 |
var curleft, curtop, cursor, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
270 |
o = this.options, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
271 |
iniPos = this.element.position(), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
272 |
el = this.element; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
273 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
274 |
this.resizing = true; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
275 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
276 |
// bugfix for http://dev.jquery.com/ticket/1749 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
277 |
if ( (/absolute/).test( el.css("position") ) ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
278 |
el.css({ position: "absolute", top: el.css("top"), left: el.css("left") }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
279 |
} else if (el.is(".ui-draggable")) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
280 |
el.css({ position: "absolute", top: iniPos.top, left: iniPos.left }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
281 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
282 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
283 |
this._renderProxy(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
284 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
285 |
curleft = num(this.helper.css("left")); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
286 |
curtop = num(this.helper.css("top")); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
287 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
288 |
if (o.containment) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
289 |
curleft += $(o.containment).scrollLeft() || 0; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
290 |
curtop += $(o.containment).scrollTop() || 0; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
291 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
292 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
293 |
//Store needed variables |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
294 |
this.offset = this.helper.offset(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
295 |
this.position = { left: curleft, top: curtop }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
296 |
this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
297 |
this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
298 |
this.originalPosition = { left: curleft, top: curtop }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
299 |
this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
300 |
this.originalMousePosition = { left: event.pageX, top: event.pageY }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
301 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
302 |
//Aspect Ratio |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
303 |
this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
304 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
305 |
cursor = $(".ui-resizable-" + this.axis).css("cursor"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
306 |
$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
307 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
308 |
el.addClass("ui-resizable-resizing"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
309 |
this._propagate("start", event); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
310 |
return true; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
311 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
312 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
313 |
_mouseDrag: function(event) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
314 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
315 |
//Increase performance, avoid regex |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
316 |
var data, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
317 |
el = this.helper, props = {}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
318 |
smp = this.originalMousePosition, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
319 |
a = this.axis, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
320 |
prevTop = this.position.top, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
321 |
prevLeft = this.position.left, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
322 |
prevWidth = this.size.width, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
323 |
prevHeight = this.size.height, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
324 |
dx = (event.pageX-smp.left)||0, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
325 |
dy = (event.pageY-smp.top)||0, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
326 |
trigger = this._change[a]; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
327 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
328 |
if (!trigger) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
329 |
return false; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
330 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
331 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
332 |
// Calculate the attrs that will be change |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
333 |
data = trigger.apply(this, [event, dx, dy]); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
334 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
335 |
// Put this in the mouseDrag handler since the user can start pressing shift while resizing |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
336 |
this._updateVirtualBoundaries(event.shiftKey); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
337 |
if (this._aspectRatio || event.shiftKey) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
338 |
data = this._updateRatio(data, event); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
339 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
340 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
341 |
data = this._respectSize(data, event); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
342 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
343 |
this._updateCache(data); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
344 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
345 |
// plugins callbacks need to be called first |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
346 |
this._propagate("resize", event); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
347 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
348 |
if (this.position.top !== prevTop) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
349 |
props.top = this.position.top + "px"; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
350 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
351 |
if (this.position.left !== prevLeft) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
352 |
props.left = this.position.left + "px"; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
353 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
354 |
if (this.size.width !== prevWidth) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
355 |
props.width = this.size.width + "px"; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
356 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
357 |
if (this.size.height !== prevHeight) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
358 |
props.height = this.size.height + "px"; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
359 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
360 |
el.css(props); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
361 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
362 |
if (!this._helper && this._proportionallyResizeElements.length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
363 |
this._proportionallyResize(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
364 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
365 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
366 |
// Call the user callback if the element was resized |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
367 |
if ( ! $.isEmptyObject(props) ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
368 |
this._trigger("resize", event, this.ui()); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
369 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
370 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
371 |
return false; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
372 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
373 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
374 |
_mouseStop: function(event) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
375 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
376 |
this.resizing = false; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
377 |
var pr, ista, soffseth, soffsetw, s, left, top, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
378 |
o = this.options, that = this; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
379 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
380 |
if(this._helper) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
381 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
382 |
pr = this._proportionallyResizeElements; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
383 |
ista = pr.length && (/textarea/i).test(pr[0].nodeName); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
384 |
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
385 |
soffsetw = ista ? 0 : that.sizeDiff.width; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
386 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
387 |
s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
388 |
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
389 |
top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
390 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
391 |
if (!o.animate) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
392 |
this.element.css($.extend(s, { top: top, left: left })); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
393 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
394 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
395 |
that.helper.height(that.size.height); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
396 |
that.helper.width(that.size.width); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
397 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
398 |
if (this._helper && !o.animate) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
399 |
this._proportionallyResize(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
400 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
401 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
402 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
403 |
$("body").css("cursor", "auto"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
404 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
405 |
this.element.removeClass("ui-resizable-resizing"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
406 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
407 |
this._propagate("stop", event); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
408 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
409 |
if (this._helper) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
410 |
this.helper.remove(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
411 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
412 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
413 |
return false; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
414 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
415 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
416 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
417 |
_updateVirtualBoundaries: function(forceAspectRatio) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
418 |
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
419 |
o = this.options; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
420 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
421 |
b = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
422 |
minWidth: isNumber(o.minWidth) ? o.minWidth : 0, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
423 |
maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
424 |
minHeight: isNumber(o.minHeight) ? o.minHeight : 0, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
425 |
maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
426 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
427 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
428 |
if(this._aspectRatio || forceAspectRatio) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
429 |
// We want to create an enclosing box whose aspect ration is the requested one |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
430 |
// First, compute the "projected" size for each dimension based on the aspect ratio and other dimension |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
431 |
pMinWidth = b.minHeight * this.aspectRatio; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
432 |
pMinHeight = b.minWidth / this.aspectRatio; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
433 |
pMaxWidth = b.maxHeight * this.aspectRatio; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
434 |
pMaxHeight = b.maxWidth / this.aspectRatio; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
435 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
436 |
if(pMinWidth > b.minWidth) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
437 |
b.minWidth = pMinWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
438 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
439 |
if(pMinHeight > b.minHeight) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
440 |
b.minHeight = pMinHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
441 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
442 |
if(pMaxWidth < b.maxWidth) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
443 |
b.maxWidth = pMaxWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
444 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
445 |
if(pMaxHeight < b.maxHeight) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
446 |
b.maxHeight = pMaxHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
447 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
448 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
449 |
this._vBoundaries = b; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
450 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
451 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
452 |
_updateCache: function(data) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
453 |
this.offset = this.helper.offset(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
454 |
if (isNumber(data.left)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
455 |
this.position.left = data.left; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
456 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
457 |
if (isNumber(data.top)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
458 |
this.position.top = data.top; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
459 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
460 |
if (isNumber(data.height)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
461 |
this.size.height = data.height; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
462 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
463 |
if (isNumber(data.width)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
464 |
this.size.width = data.width; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
465 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
466 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
467 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
468 |
_updateRatio: function( data ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
469 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
470 |
var cpos = this.position, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
471 |
csize = this.size, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
472 |
a = this.axis; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
473 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
474 |
if (isNumber(data.height)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
475 |
data.width = (data.height * this.aspectRatio); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
476 |
} else if (isNumber(data.width)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
477 |
data.height = (data.width / this.aspectRatio); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
478 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
479 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
480 |
if (a === "sw") { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
481 |
data.left = cpos.left + (csize.width - data.width); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
482 |
data.top = null; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
483 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
484 |
if (a === "nw") { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
485 |
data.top = cpos.top + (csize.height - data.height); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
486 |
data.left = cpos.left + (csize.width - data.width); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
487 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
488 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
489 |
return data; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
490 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
491 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
492 |
_respectSize: function( data ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
493 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
494 |
var o = this._vBoundaries, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
495 |
a = this.axis, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
496 |
ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
497 |
isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
498 |
dw = this.originalPosition.left + this.originalSize.width, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
499 |
dh = this.position.top + this.size.height, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
500 |
cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
501 |
if (isminw) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
502 |
data.width = o.minWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
503 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
504 |
if (isminh) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
505 |
data.height = o.minHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
506 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
507 |
if (ismaxw) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
508 |
data.width = o.maxWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
509 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
510 |
if (ismaxh) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
511 |
data.height = o.maxHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
512 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
513 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
514 |
if (isminw && cw) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
515 |
data.left = dw - o.minWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
516 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
517 |
if (ismaxw && cw) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
518 |
data.left = dw - o.maxWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
519 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
520 |
if (isminh && ch) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
521 |
data.top = dh - o.minHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
522 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
523 |
if (ismaxh && ch) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
524 |
data.top = dh - o.maxHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
525 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
526 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
527 |
// fixing jump error on top/left - bug #2330 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
528 |
if (!data.width && !data.height && !data.left && data.top) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
529 |
data.top = null; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
530 |
} else if (!data.width && !data.height && !data.top && data.left) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
531 |
data.left = null; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
532 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
533 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
534 |
return data; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
535 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
536 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
537 |
_proportionallyResize: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
538 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
539 |
if (!this._proportionallyResizeElements.length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
540 |
return; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
541 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
542 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
543 |
var i, j, borders, paddings, prel, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
544 |
element = this.helper || this.element; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
545 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
546 |
for ( i=0; i < this._proportionallyResizeElements.length; i++) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
547 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
548 |
prel = this._proportionallyResizeElements[i]; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
549 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
550 |
if (!this.borderDif) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
551 |
this.borderDif = []; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
552 |
borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")]; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
553 |
paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")]; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
554 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
555 |
for ( j = 0; j < borders.length; j++ ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
556 |
this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 ); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
557 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
558 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
559 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
560 |
prel.css({ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
561 |
height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
562 |
width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
563 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
564 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
565 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
566 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
567 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
568 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
569 |
_renderProxy: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
570 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
571 |
var el = this.element, o = this.options; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
572 |
this.elementOffset = el.offset(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
573 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
574 |
if(this._helper) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
575 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
576 |
this.helper = this.helper || $("<div style='overflow:hidden;'></div>"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
577 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
578 |
this.helper.addClass(this._helper).css({ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
579 |
width: this.element.outerWidth() - 1, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
580 |
height: this.element.outerHeight() - 1, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
581 |
position: "absolute", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
582 |
left: this.elementOffset.left +"px", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
583 |
top: this.elementOffset.top +"px", |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
584 |
zIndex: ++o.zIndex //TODO: Don't modify option |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
585 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
586 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
587 |
this.helper |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
588 |
.appendTo("body") |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
589 |
.disableSelection(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
590 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
591 |
} else { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
592 |
this.helper = this.element; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
593 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
594 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
595 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
596 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
597 |
_change: { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
598 |
e: function(event, dx) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
599 |
return { width: this.originalSize.width + dx }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
600 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
601 |
w: function(event, dx) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
602 |
var cs = this.originalSize, sp = this.originalPosition; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
603 |
return { left: sp.left + dx, width: cs.width - dx }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
604 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
605 |
n: function(event, dx, dy) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
606 |
var cs = this.originalSize, sp = this.originalPosition; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
607 |
return { top: sp.top + dy, height: cs.height - dy }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
608 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
609 |
s: function(event, dx, dy) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
610 |
return { height: this.originalSize.height + dy }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
611 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
612 |
se: function(event, dx, dy) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
613 |
return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
614 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
615 |
sw: function(event, dx, dy) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
616 |
return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
617 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
618 |
ne: function(event, dx, dy) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
619 |
return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
620 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
621 |
nw: function(event, dx, dy) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
622 |
return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
623 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
624 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
625 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
626 |
_propagate: function(n, event) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
627 |
$.ui.plugin.call(this, n, [event, this.ui()]); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
628 |
(n !== "resize" && this._trigger(n, event, this.ui())); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
629 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
630 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
631 |
plugins: {}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
632 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
633 |
ui: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
634 |
return { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
635 |
originalElement: this.originalElement, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
636 |
element: this.element, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
637 |
helper: this.helper, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
638 |
position: this.position, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
639 |
size: this.size, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
640 |
originalSize: this.originalSize, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
641 |
originalPosition: this.originalPosition |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
642 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
643 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
644 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
645 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
646 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
647 |
/* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
648 |
* Resizable Extensions |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
649 |
*/ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
650 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
651 |
$.ui.plugin.add("resizable", "animate", { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
652 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
653 |
stop: function( event ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
654 |
var that = $(this).data("ui-resizable"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
655 |
o = that.options, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
656 |
pr = that._proportionallyResizeElements, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
657 |
ista = pr.length && (/textarea/i).test(pr[0].nodeName), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
658 |
soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
659 |
soffsetw = ista ? 0 : that.sizeDiff.width, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
660 |
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
661 |
left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
662 |
top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
663 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
664 |
that.element.animate( |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
665 |
$.extend(style, top && left ? { top: top, left: left } : {}), { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
666 |
duration: o.animateDuration, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
667 |
easing: o.animateEasing, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
668 |
step: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
669 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
670 |
var data = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
671 |
width: parseInt(that.element.css("width"), 10), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
672 |
height: parseInt(that.element.css("height"), 10), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
673 |
top: parseInt(that.element.css("top"), 10), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
674 |
left: parseInt(that.element.css("left"), 10) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
675 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
676 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
677 |
if (pr && pr.length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
678 |
$(pr[0]).css({ width: data.width, height: data.height }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
679 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
680 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
681 |
// propagating resize, and updating values for each animation step |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
682 |
that._updateCache(data); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
683 |
that._propagate("resize", event); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
684 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
685 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
686 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
687 |
); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
688 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
689 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
690 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
691 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
692 |
$.ui.plugin.add("resizable", "containment", { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
693 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
694 |
start: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
695 |
var element, p, co, ch, cw, width, height, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
696 |
that = $(this).data("ui-resizable"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
697 |
o = that.options, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
698 |
el = that.element, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
699 |
oc = o.containment, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
700 |
ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
701 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
702 |
if (!ce) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
703 |
return; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
704 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
705 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
706 |
that.containerElement = $(ce); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
707 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
708 |
if (/document/.test(oc) || oc === document) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
709 |
that.containerOffset = { left: 0, top: 0 }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
710 |
that.containerPosition = { left: 0, top: 0 }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
711 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
712 |
that.parentData = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
713 |
element: $(document), left: 0, top: 0, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
714 |
width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
715 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
716 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
717 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
718 |
// i'm a node, so compute top, left, right, bottom |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
719 |
else { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
720 |
element = $(ce); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
721 |
p = []; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
722 |
$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
723 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
724 |
that.containerOffset = element.offset(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
725 |
that.containerPosition = element.position(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
726 |
that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
727 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
728 |
co = that.containerOffset; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
729 |
ch = that.containerSize.height; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
730 |
cw = that.containerSize.width; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
731 |
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
732 |
height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
733 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
734 |
that.parentData = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
735 |
element: ce, left: co.left, top: co.top, width: width, height: height |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
736 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
737 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
738 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
739 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
740 |
resize: function( event ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
741 |
var woset, hoset, isParent, isOffsetRelative, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
742 |
that = $(this).data("ui-resizable"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
743 |
o = that.options, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
744 |
co = that.containerOffset, cp = that.position, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
745 |
pRatio = that._aspectRatio || event.shiftKey, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
746 |
cop = { top:0, left:0 }, ce = that.containerElement; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
747 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
748 |
if (ce[0] !== document && (/static/).test(ce.css("position"))) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
749 |
cop = co; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
750 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
751 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
752 |
if (cp.left < (that._helper ? co.left : 0)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
753 |
that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left)); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
754 |
if (pRatio) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
755 |
that.size.height = that.size.width / that.aspectRatio; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
756 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
757 |
that.position.left = o.helper ? co.left : 0; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
758 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
759 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
760 |
if (cp.top < (that._helper ? co.top : 0)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
761 |
that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
762 |
if (pRatio) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
763 |
that.size.width = that.size.height * that.aspectRatio; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
764 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
765 |
that.position.top = that._helper ? co.top : 0; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
766 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
767 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
768 |
that.offset.left = that.parentData.left+that.position.left; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
769 |
that.offset.top = that.parentData.top+that.position.top; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
770 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
771 |
woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
772 |
hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height ); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
773 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
774 |
isParent = that.containerElement.get(0) === that.element.parent().get(0); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
775 |
isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
776 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
777 |
if(isParent && isOffsetRelative) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
778 |
woset -= that.parentData.left; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
779 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
780 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
781 |
if (woset + that.size.width >= that.parentData.width) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
782 |
that.size.width = that.parentData.width - woset; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
783 |
if (pRatio) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
784 |
that.size.height = that.size.width / that.aspectRatio; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
785 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
786 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
787 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
788 |
if (hoset + that.size.height >= that.parentData.height) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
789 |
that.size.height = that.parentData.height - hoset; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
790 |
if (pRatio) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
791 |
that.size.width = that.size.height * that.aspectRatio; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
792 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
793 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
794 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
795 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
796 |
stop: function(){ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
797 |
var that = $(this).data("ui-resizable"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
798 |
o = that.options, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
799 |
co = that.containerOffset, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
800 |
cop = that.containerPosition, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
801 |
ce = that.containerElement, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
802 |
helper = $(that.helper), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
803 |
ho = helper.offset(), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
804 |
w = helper.outerWidth() - that.sizeDiff.width, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
805 |
h = helper.outerHeight() - that.sizeDiff.height; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
806 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
807 |
if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
808 |
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
809 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
810 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
811 |
if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
812 |
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
813 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
814 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
815 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
816 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
817 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
818 |
$.ui.plugin.add("resizable", "alsoResize", { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
819 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
820 |
start: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
821 |
var that = $(this).data("ui-resizable"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
822 |
o = that.options, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
823 |
_store = function (exp) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
824 |
$(exp).each(function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
825 |
var el = $(this); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
826 |
el.data("ui-resizable-alsoresize", { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
827 |
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
828 |
left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
829 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
830 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
831 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
832 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
833 |
if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
834 |
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
835 |
else { $.each(o.alsoResize, function (exp) { _store(exp); }); } |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
836 |
}else{ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
837 |
_store(o.alsoResize); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
838 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
839 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
840 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
841 |
resize: function (event, ui) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
842 |
var that = $(this).data("ui-resizable"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
843 |
o = that.options, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
844 |
os = that.originalSize, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
845 |
op = that.originalPosition, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
846 |
delta = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
847 |
height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
848 |
top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
849 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
850 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
851 |
_alsoResize = function (exp, c) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
852 |
$(exp).each(function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
853 |
var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
854 |
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"]; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
855 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
856 |
$.each(css, function (i, prop) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
857 |
var sum = (start[prop]||0) + (delta[prop]||0); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
858 |
if (sum && sum >= 0) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
859 |
style[prop] = sum || null; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
860 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
861 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
862 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
863 |
el.css(style); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
864 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
865 |
}; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
866 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
867 |
if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
868 |
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
869 |
}else{ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
870 |
_alsoResize(o.alsoResize); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
871 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
872 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
873 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
874 |
stop: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
875 |
$(this).removeData("resizable-alsoresize"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
876 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
877 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
878 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
879 |
$.ui.plugin.add("resizable", "ghost", { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
880 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
881 |
start: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
882 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
883 |
var that = $(this).data("ui-resizable"), o = that.options, cs = that.size; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
884 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
885 |
that.ghost = that.originalElement.clone(); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
886 |
that.ghost |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
887 |
.css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
888 |
.addClass("ui-resizable-ghost") |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
889 |
.addClass(typeof o.ghost === "string" ? o.ghost : ""); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
890 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
891 |
that.ghost.appendTo(that.helper); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
892 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
893 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
894 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
895 |
resize: function(){ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
896 |
var that = $(this).data("ui-resizable"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
897 |
if (that.ghost) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
898 |
that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width }); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
899 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
900 |
}, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
901 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
902 |
stop: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
903 |
var that = $(this).data("ui-resizable"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
904 |
if (that.ghost && that.helper) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
905 |
that.helper.get(0).removeChild(that.ghost.get(0)); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
906 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
907 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
908 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
909 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
910 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
911 |
$.ui.plugin.add("resizable", "grid", { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
912 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
913 |
resize: function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
914 |
var that = $(this).data("ui-resizable"), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
915 |
o = that.options, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
916 |
cs = that.size, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
917 |
os = that.originalSize, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
918 |
op = that.originalPosition, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
919 |
a = that.axis, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
920 |
grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
921 |
gridX = (grid[0]||1), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
922 |
gridY = (grid[1]||1), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
923 |
ox = Math.round((cs.width - os.width) / gridX) * gridX, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
924 |
oy = Math.round((cs.height - os.height) / gridY) * gridY, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
925 |
newWidth = os.width + ox, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
926 |
newHeight = os.height + oy, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
927 |
isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
928 |
isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
929 |
isMinWidth = o.minWidth && (o.minWidth > newWidth), |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
930 |
isMinHeight = o.minHeight && (o.minHeight > newHeight); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
931 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
932 |
o.grid = grid; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
933 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
934 |
if (isMinWidth) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
935 |
newWidth = newWidth + gridX; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
936 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
937 |
if (isMinHeight) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
938 |
newHeight = newHeight + gridY; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
939 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
940 |
if (isMaxWidth) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
941 |
newWidth = newWidth - gridX; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
942 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
943 |
if (isMaxHeight) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
944 |
newHeight = newHeight - gridY; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
945 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
946 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
947 |
if (/^(se|s|e)$/.test(a)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
948 |
that.size.width = newWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
949 |
that.size.height = newHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
950 |
} else if (/^(ne)$/.test(a)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
951 |
that.size.width = newWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
952 |
that.size.height = newHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
953 |
that.position.top = op.top - oy; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
954 |
} else if (/^(sw)$/.test(a)) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
955 |
that.size.width = newWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
956 |
that.size.height = newHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
957 |
that.position.left = op.left - ox; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
958 |
} else { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
959 |
that.size.width = newWidth; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
960 |
that.size.height = newHeight; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
961 |
that.position.top = op.top - oy; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
962 |
that.position.left = op.left - ox; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
963 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
964 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
965 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
966 |
}); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
967 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
968 |
})(jQuery); |