зеркало из https://github.com/mozilla/popcorn-js.git
Родитель
f24607b603
Коммит
8f0c275d6d
|
@ -22,6 +22,14 @@
|
||||||
|
|
||||||
// The underlying player resource. May be <canvas>, <iframe>, <object>, array, etc
|
// The underlying player resource. May be <canvas>, <iframe>, <object>, array, etc
|
||||||
this.resource;
|
this.resource;
|
||||||
|
// The container div of the resource
|
||||||
|
this._container;
|
||||||
|
|
||||||
|
this.offsetWidth = this.width = 0;
|
||||||
|
this.offsetHeight = this.height = 0;
|
||||||
|
this.offsetLeft = 0;
|
||||||
|
this.offsetTop = 0;
|
||||||
|
this.offsetParent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Popcorn.baseplayer.init.prototype = {
|
Popcorn.baseplayer.init.prototype = {
|
||||||
|
@ -55,18 +63,35 @@
|
||||||
// By default, assumes this.resource is a DOM Element
|
// By default, assumes this.resource is a DOM Element
|
||||||
// Changing the type of this.resource requires this method to be overridden
|
// Changing the type of this.resource requires this method to be overridden
|
||||||
getBoundingClientRect: function() {
|
getBoundingClientRect: function() {
|
||||||
var b = this.resource.getBoundingClientRect();
|
var b,
|
||||||
|
self = this;
|
||||||
|
|
||||||
return {
|
if ( this.resource ) {
|
||||||
bottom: b.bottom,
|
b = this.resource.getBoundingClientRect();
|
||||||
left: b.left,
|
|
||||||
right: b.right,
|
|
||||||
top: b.top,
|
|
||||||
|
|
||||||
// These not guaranteed to be in there
|
return {
|
||||||
width: b.width || ( b.right - b.left ),
|
bottom: b.bottom,
|
||||||
height: b.height || ( b.bottom - b.top )
|
left: b.left,
|
||||||
};
|
right: b.right,
|
||||||
|
top: b.top,
|
||||||
|
|
||||||
|
// These not guaranteed to be in there
|
||||||
|
width: b.width || ( b.right - b.left ),
|
||||||
|
height: b.height || ( b.bottom - b.top )
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
b = this._container.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Update bottom, right for expected values once the container loads
|
||||||
|
return {
|
||||||
|
left: b.left,
|
||||||
|
top: b.top,
|
||||||
|
width: self.offsetWidth,
|
||||||
|
height: self.offsetHeight,
|
||||||
|
bottom: b.top + this.width,
|
||||||
|
right: b.top + this.height
|
||||||
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// By default, assumes this.resource is a DOM Element
|
// By default, assumes this.resource is a DOM Element
|
||||||
|
|
Загрузка…
Ссылка в новой задаче