Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add player.currentWidth and player.currentHeight* methods for getting computed style #3144

Closed
wants to merge 2 commits into from

Conversation

defli
Copy link

@defli defli commented Feb 27, 2016

Description

Add player.currentWidth and player.currentHeight* methods for getting computed style

Specific Changes proposed

API methods:
Component
Component.prototype.currentDimension(widthOrHeight) -> Number - It takes a string value of either width or height to return back the appropriate value
Component.prototype.currentDimensions() -> Object{width: Number, height: Number} - Returns an object with width and height properties
Component.prototype.currentHeight() -> Number - Delegates to Component#currentDimension to get back the height value
Component.prototype.currentWidth() -> Number - Delegates to Component#currentDimension to get back the width value
Player - We probably don't need to make any changes in the player because it extends from component and will inherit the functionality from it.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
  • Reviewed by Two Core Contributors

Add `player.currentWidth` and `player.currentHeight`* methods for getting computed style

## Specific Changes proposed
API methods:

Component
Component.prototype.currentDimension(widthOrHeight) -> Number - It takes a string value of either width or height to return back the appropriate value
Component.prototype.currentDimensions() -> Object{width: Number, height: Number} - Returns an object with width and height properties
Component.prototype.currentHeight() -> Number - Delegates to Component#currentDimension to get back the height value
Component.prototype.currentWidth() -> Number - Delegates to Component#currentDimension to get back the width value

## Requirements Checklist
- [ X ] Feature implemented / Bug fixed
- [ X ] If necessary, more likely in a feature request than a bug fix
  - [ X ] Unit Tests updated or fixed
  - [ ] Docs/guides updated
  - [ ] Example created ([starter template on JSBin](http://jsbin.com/axedog/edit?html,output))
- [ ] Reviewed by Two Core Contributors
@gkatsev
Copy link
Member

gkatsev commented Mar 3, 2016

Thanks. Sorry it's taken so long to take a look. At a quick glance, this looks good. I'll make some more in-depths comments tomorrow.
Appreciate the help!

@defli
Copy link
Author

defli commented Mar 3, 2016

@gkatsev you're welcome 👍 after your full review, I am going to fix issues.

return false;
}

if (typeof window.getComputedStyle !== 'undefined') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

safer to check that it's equal to "function".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

@gkatsev
Copy link
Member

gkatsev commented Mar 3, 2016

I made some comments. Let me know if you have questions or need any help!

@defli
Copy link
Author

defli commented Mar 4, 2016

@gkatsev I fixed issues.

@gkatsev
Copy link
Member

gkatsev commented Mar 7, 2016

LGTM, thanks.

@gkatsev gkatsev added minor This PR can be added to a minor release. It should not be added to a patch release. needs: LGTM Needs one or more additional approvals labels Mar 7, 2016
@gkatsev
Copy link
Member

gkatsev commented Mar 14, 2016

@videojs/core-committers anyone else care to do a code review?


if (typeof window.getComputedStyle === 'function') {
const computedStyle = window.getComputedStyle(this.el_);
computedWidthOrHeight = computedStyle.getPropertyValue(widthOrHeight) || computedStyle[ widthOrHeight ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor style comment: spaces inside [ and ].

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be fixed during merge; so, ignore me!

@misteroneill
Copy link
Member

LGTM

@gkatsev gkatsev added confirmed and removed needs: LGTM Needs one or more additional approvals labels Mar 15, 2016
@gkatsev gkatsev closed this in ac3771a Mar 25, 2016
@gkatsev
Copy link
Member

gkatsev commented Mar 25, 2016

@defli thanks for your help! Looking forward to more contributions from you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed minor This PR can be added to a minor release. It should not be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants