mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Access other static DomElement methods through 'this'.
This commit is contained in:
parent
f18b5df99d
commit
f610acedf2
1 changed files with 8 additions and 8 deletions
|
@ -47,7 +47,7 @@ var DomElement = new function() {
|
|||
|
||||
getViewportSize: function(el) {
|
||||
var doc = el.ownerDocument,
|
||||
view = DomElement.getViewport(doc),
|
||||
view = this.getViewport(doc),
|
||||
body = doc.getElementsByTagName(
|
||||
doc.compatMode === 'CSS1Compat' ? 'html' : 'body')[0];
|
||||
return Size.create(
|
||||
|
@ -59,7 +59,7 @@ var DomElement = new function() {
|
|||
getComputedStyle: function(el, name) {
|
||||
if (el.currentStyle)
|
||||
return el.currentStyle[Base.camelize(name)];
|
||||
var style = DomElement.getViewport(el.ownerDocument)
|
||||
var style = this.getViewport(el.ownerDocument)
|
||||
.getComputedStyle(el, null);
|
||||
return style ? style.getPropertyValue(Base.hyphenate(name)) : null;
|
||||
},
|
||||
|
@ -84,15 +84,15 @@ var DomElement = new function() {
|
|||
},
|
||||
|
||||
getBounds: function(el, positioned, viewport) {
|
||||
return new Rectangle(DomElement.getOffset(el, positioned, viewport),
|
||||
DomElement.getSize(el));
|
||||
return new Rectangle(this.getOffset(el, positioned, viewport),
|
||||
this.getSize(el));
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if element is invisibile (display: none, ...)
|
||||
*/
|
||||
isInvisible: function(el) {
|
||||
return DomElement.getSize(el).equals([0, 0]);
|
||||
return this.getSize(el).equals([0, 0]);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -101,9 +101,9 @@ var DomElement = new function() {
|
|||
isVisible: function(el) {
|
||||
// See if the viewport bounds intersect with the windows rectangle
|
||||
// which always starts at 0, 0
|
||||
return !DomElement.isInvisible(el)
|
||||
&& new Rectangle([0, 0], DomElement.getViewportSize(el))
|
||||
.intersects(DomElement.getBounds(el, false, true));
|
||||
return !this.isInvisible(el)
|
||||
&& new Rectangle([0, 0], this.getViewportSize(el))
|
||||
.intersects(this.getBounds(el, false, true));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue