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

Embed Share Width #41431

Merged
merged 3 commits into from Jul 21, 2021
Merged

Embed Share Width #41431

merged 3 commits into from Jul 21, 2021

Conversation

epeach
Copy link

@epeach epeach commented Jul 2, 2021

After fighting with relative and fixed positioning in CSS for this PR chain: #41136, I decided to just go with the simple solution. This means we are still using divs for spacing, but there are so many factors at play in the spacing, I think it just makes sense to let that exist (if it works, it works). This adds the 40 pixel offset to the calculation of embeded app, which takes into account the 20 pixel spacing for the left and right container. Because this is scoped to the embedded share view, I can ignore the comment that says changes in width should also be added to visualizationColumn.wireframeShare.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@epeach epeach requested a review from a team July 2, 2021 16:33
@@ -210,7 +210,8 @@ class ShareAllowedDialog extends React.Component {
embedOptions = {
// If you change this width and height, make sure to update the
// #visualizationColumn.wireframeShare css
iframeHeight: applabConstants.APP_HEIGHT + 140,
// Extra 40 pixels added to account for left and right padding divs (20 px each side)
iframeHeight: applabConstants.APP_HEIGHT + 140 + 40,
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe i'm missing something, but why are we changing iframeHeight instead of iframeWidth here?

Copy link
Contributor

Choose a reason for hiding this comment

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

also, there's a comment above that seems relevant:

// If you change this width and height, make sure to update the
// #visualizationColumn.wireframeShare css 

Copy link
Author

Choose a reason for hiding this comment

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

Ah whoops, when refactoring, I added the pixels to the wrong height/width, so I'll need to go ahead and switch that back.

Copy link
Author

Choose a reason for hiding this comment

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

As far as the comment, I tried to address that in the PR description: Because this is scoped to the embedded share view, I can ignore the comment that says changes in width should also be added to visualizationColumn.wireframeShare. This issue is limited to the embed share view, but not the traditional share page. The css in the visualizationColumn.wireframeShare keeps track of the width of the visualization. This embedded width calculation is used to determine how big the embedded iframe should be. So the phone visualization width stays the same, but since the embedded iframe holds the phone visualization and the spacing divs, we calculate the embedded iframe width using both the width of the phone visualization and the spacing divs. This comment is from many years ago, so there's not a lot of context on it, but this is my understanding based on some GitHub archaeology. It's hard for me to describe without showing you the different divs, so let me know if you want to hop on a video call!

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, sorry, i missed that detail in your PR description. i mostly understand, but can you point me to where/how the "spacing divs" are rendered? i'm wondering if we have this same problem in gamelab, but i don't quite understand where the spacing divs come into play.

Copy link
Author

Choose a reason for hiding this comment

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

"containerLeft", for spacing:

// Create an empty div on the left for padding

As far as whether this affects Game Lab, the answer is . . . yes? But also no. At some point along the way, the phone frame was removed from the Game Lab share visualization, but the calculated embed width (

iframeWidth: p5labConstants.APP_WIDTH + 32
), was never updated to remove the 32 pixels that are added to account for the frame. So, because we add the 32 pixels, the visualization is not cut off (although part of the 20px spacing div on the right is). So it's in the same situation, but didn't have the bug that AppLab did.

Copy link
Author

Choose a reason for hiding this comment

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

I'm going to update the offset for GameLab to be 4o pxls so that it's clear how that lines up with the AppLab one.

@epeach epeach merged commit a27435a into staging Jul 21, 2021
@epeach epeach deleted the applab-embed-width branch July 21, 2021 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants