]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#488] Replace getBoundingClientRect with pass through method to Popcorn.position()
authorRick Waldron <waldron.rick@gmail.com>
Sun, 8 May 2011 23:45:05 +0000 (19:45 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Sun, 8 May 2011 23:45:05 +0000 (19:45 -0400)
players/baseplayer/popcorn.baseplayer.js

index 30b7a2db548405b58bb7578428bfff6b08c64b00..fe85e2d2523d980e902f4879db64f5ec1a9116f5 100644 (file)
     // By default, assumes this.resource is a DOM Element
     // Changing the type of this.resource requires this method to be overridden
     getBoundingClientRect: function() {
-      var b,
-          self = this;
-          
-      if ( this._resource ) {
-        b = this._resource.getBoundingClientRect();
-        
-        return {
-          bottom: Math.ceil( b.bottom ),
-          left: Math.ceil( b.left ),
-          right: Math.ceil( b.right ),
-          top: Math.ceil( 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
-        };
-      }
-    },
+                       return Popcorn.position( this._resource || this._container );
+         },
     
     // Add an event listener to the object
     addEventListener: function( evtName, fn ) {