summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/MochiKit/Position.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/MochiKit/Position.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/MochiKit/Position.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/frontend/gamma/js/MochiKit/Position.js b/frontend/gamma/js/MochiKit/Position.js
index 6bc5b39..2680507 100644
--- a/frontend/gamma/js/MochiKit/Position.js
+++ b/frontend/gamma/js/MochiKit/Position.js
@@ -1,107 +1,107 @@
1/*** 1/***
2 2
3MochiKit.Position 1.5 3MochiKit.Position 1.5
4 4
5See <http://mochikit.com/> for documentation, downloads, license, etc. 5See <http://mochikit.com/> for documentation, downloads, license, etc.
6 6
7(c) 2005-2006 Bob Ippolito and others. All rights Reserved. 7(c) 2005-2006 Bob Ippolito and others. All rights Reserved.
8 8
9***/ 9***/
10 10
11MochiKit.Base._module('Position', '1.5', ['Base', 'DOM', 'Style']); 11MochiKit.Base.module(MochiKit, 'Position', '1.5', ['Base', 'DOM', 'Style']);
12 12
13MochiKit.Base.update(MochiKit.Position, { 13MochiKit.Base.update(MochiKit.Position, {
14 // Don't export from this module 14 // Don't export from this module
15 __export__: false, 15 __export__: false,
16 16
17 // set to true if needed, warning: firefox performance problems 17 // set to true if needed, warning: firefox performance problems
18 // NOT neeeded for page scrolling, only if draggable contained in 18 // NOT neeeded for page scrolling, only if draggable contained in
19 // scrollable elements 19 // scrollable elements
20 includeScrollOffsets: false, 20 includeScrollOffsets: false,
21 21
22 /** @id MochiKit.Position.prepare */ 22 /** @id MochiKit.Position.prepare */
23 prepare: function () { 23 prepare: function () {
24 var deltaX = window.pageXOffset 24 var deltaX = window.pageXOffset
25 || document.documentElement.scrollLeft 25 || document.documentElement.scrollLeft
26 || document.body.scrollLeft 26 || document.body.scrollLeft
27 || 0; 27 || 0;
28 var deltaY = window.pageYOffset 28 var deltaY = window.pageYOffset
29 || document.documentElement.scrollTop 29 || document.documentElement.scrollTop
30 || document.body.scrollTop 30 || document.body.scrollTop
31 || 0; 31 || 0;
32 this.windowOffset = new MochiKit.Style.Coordinates(deltaX, deltaY); 32 this.windowOffset = new MochiKit.Style.Coordinates(deltaX, deltaY);
33 }, 33 },
34 34
35 /** @id MochiKit.Position.cumulativeOffset */ 35 /** @id MochiKit.Position.cumulativeOffset */
36 cumulativeOffset: function (element) { 36 cumulativeOffset: function (element) {
37 var valueT = 0; 37 var valueT = 0;
38 var valueL = 0; 38 var valueL = 0;
39 do { 39 do {
40 valueT += element.offsetTop || 0; 40 valueT += element.offsetTop || 0;
41 valueL += element.offsetLeft || 0; 41 valueL += element.offsetLeft || 0;
42 element = element.offsetParent; 42 element = element.offsetParent;
43 } while (element); 43 } while (element);
44 return new MochiKit.Style.Coordinates(valueL, valueT); 44 return new MochiKit.Style.Coordinates(valueL, valueT);
45 }, 45 },
46 46
47 /** @id MochiKit.Position.realOffset */ 47 /** @id MochiKit.Position.realOffset */
48 realOffset: function (element) { 48 realOffset: function (element) {
49 var valueT = 0; 49 var valueT = 0;
50 var valueL = 0; 50 var valueL = 0;
51 do { 51 do {
52 valueT += element.scrollTop || 0; 52 valueT += element.scrollTop || 0;
53 valueL += element.scrollLeft || 0; 53 valueL += element.scrollLeft || 0;
54 element = element.parentNode; 54 element = element.parentNode;
55 } while (element); 55 } while (element);
56 return new MochiKit.Style.Coordinates(valueL, valueT); 56 return new MochiKit.Style.Coordinates(valueL, valueT);
57 }, 57 },
58 58
59 /** @id MochiKit.Position.within */ 59 /** @id MochiKit.Position.within */
60 within: function (element, x, y) { 60 within: function (element, x, y) {
61 if (this.includeScrollOffsets) { 61 if (this.includeScrollOffsets) {
62 return this.withinIncludingScrolloffsets(element, x, y); 62 return this.withinIncludingScrolloffsets(element, x, y);
63 } 63 }
64 this.xcomp = x; 64 this.xcomp = x;
65 this.ycomp = y; 65 this.ycomp = y;
66 this.offset = this.cumulativeOffset(element); 66 this.offset = this.cumulativeOffset(element);
67 if (element.style.position == "fixed") { 67 if (element.style.position == "fixed") {
68 this.offset.x += this.windowOffset.x; 68 this.offset.x += this.windowOffset.x;
69 this.offset.y += this.windowOffset.y; 69 this.offset.y += this.windowOffset.y;
70 } 70 }
71 71
72 return (y >= this.offset.y && 72 return (y >= this.offset.y &&
73 y < this.offset.y + element.offsetHeight && 73 y < this.offset.y + element.offsetHeight &&
74 x >= this.offset.x && 74 x >= this.offset.x &&
75 x < this.offset.x + element.offsetWidth); 75 x < this.offset.x + element.offsetWidth);
76 }, 76 },
77 77
78 /** @id MochiKit.Position.withinIncludingScrolloffsets */ 78 /** @id MochiKit.Position.withinIncludingScrolloffsets */
79 withinIncludingScrolloffsets: function (element, x, y) { 79 withinIncludingScrolloffsets: function (element, x, y) {
80 var offsetcache = this.realOffset(element); 80 var offsetcache = this.realOffset(element);
81 81
82 this.xcomp = x + offsetcache.x - this.windowOffset.x; 82 this.xcomp = x + offsetcache.x - this.windowOffset.x;
83 this.ycomp = y + offsetcache.y - this.windowOffset.y; 83 this.ycomp = y + offsetcache.y - this.windowOffset.y;
84 this.offset = this.cumulativeOffset(element); 84 this.offset = this.cumulativeOffset(element);
85 85
86 return (this.ycomp >= this.offset.y && 86 return (this.ycomp >= this.offset.y &&
87 this.ycomp < this.offset.y + element.offsetHeight && 87 this.ycomp < this.offset.y + element.offsetHeight &&
88 this.xcomp >= this.offset.x && 88 this.xcomp >= this.offset.x &&
89 this.xcomp < this.offset.x + element.offsetWidth); 89 this.xcomp < this.offset.x + element.offsetWidth);
90 }, 90 },
91 91
92 // within must be called directly before 92 // within must be called directly before
93 /** @id MochiKit.Position.overlap */ 93 /** @id MochiKit.Position.overlap */
94 overlap: function (mode, element) { 94 overlap: function (mode, element) {
95 if (!mode) { 95 if (!mode) {
96 return 0; 96 return 0;
97 } 97 }
98 if (mode == 'vertical') { 98 if (mode == 'vertical') {
99 return ((this.offset.y + element.offsetHeight) - this.ycomp) / 99 return ((this.offset.y + element.offsetHeight) - this.ycomp) /
100 element.offsetHeight; 100 element.offsetHeight;
101 } 101 }
102 if (mode == 'horizontal') { 102 if (mode == 'horizontal') {
103 return ((this.offset.x + element.offsetWidth) - this.xcomp) / 103 return ((this.offset.x + element.offsetWidth) - this.xcomp) /
104 element.offsetWidth; 104 element.offsetWidth;
105 } 105 }
106 }, 106 },
107 107