mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
bd58e931bb
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41872 467b73ca-7a2a-4603-9d3b-597d59a354a9
72 lines
1.7 KiB
JavaScript
72 lines
1.7 KiB
JavaScript
/**
|
|
* @author Mateusz
|
|
*/
|
|
Point = {
|
|
initialize: function(x,y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
}
|
|
|
|
EventStack = {
|
|
lastEvent: null,
|
|
getLastEvent: function(){
|
|
return EventStack.lastEvent
|
|
},
|
|
|
|
addEvent: function(event) {
|
|
EventStack.lastEvent = event;
|
|
},
|
|
|
|
clearStack: function() {
|
|
this.lastEvent = null;
|
|
}
|
|
}
|
|
|
|
Positioning = {
|
|
addBehaviour: function(element) {
|
|
this.element = element;
|
|
this.element.getTop = Positioning.getTop.bind(this);
|
|
this.element.getLeft = Positioning.getLeft.bind(this);
|
|
this.element.getWidth = Positioning.getWidth.bind(this);
|
|
this.element.getHeight = Positioning.getHeight.bind(this);
|
|
this.element.getParentLeft = Positioning.getParentLeft.bind(this);
|
|
this.element.getParentTop = Positioning.getParentTop.bind(this);
|
|
this.element.getParentHeight = Positioning.getParentHeight.bind(this);
|
|
this.element.getParentWidth = Positioning.getParentWidth.bind(this);
|
|
},
|
|
|
|
getTop: function() {
|
|
return Position.positionedOffset(this.element)[1];
|
|
},
|
|
|
|
getLeft: function() {
|
|
return Position.positionedOffset(this.element)[0];
|
|
},
|
|
|
|
getWidth: function() {
|
|
return Element.getDimensions(this.element).width;
|
|
},
|
|
|
|
getHeight: function() {
|
|
return Element.getDimensions(this.element).height;
|
|
},
|
|
|
|
getParentLeft: function() {
|
|
parentLeft = Position.cumulativeOffset(Position.offsetParent(this.element))[0];
|
|
return parentLeft;
|
|
},
|
|
|
|
getParentTop: function() {
|
|
parentTop = Position.cumulativeOffset(Position.offsetParent(this.element))[1];
|
|
return parentTop;
|
|
},
|
|
|
|
getParentHeight: function() {
|
|
return Element.getDimensions(Position.offsetParent(this.element)).height;
|
|
},
|
|
|
|
getParentWidth: function() {
|
|
return Element.getDimensions(Position.offsetParent(this.element)).width
|
|
}
|
|
} |