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

Don't update shadow values on mini toolbox blocks when mini toolbox is closed #228

Merged
merged 2 commits into from Jun 24, 2020

Conversation

ajpal
Copy link
Contributor

@ajpal ajpal commented Jun 24, 2020

There was a rendering issue in some browsers (Firefox, IE, Edge):
image

The root cause is that getComputedTextLength() returns 0 if the text element is not visible. So basically, when we updated the object block, the "object" label thought its width was 0, so the preview went on top of it. The solution is to not update the minitoolbox blocks when the flyout is closed, and this corresponding PR updates them when the flyout opens

This PR also renames tray to isMiniFlyoutOpen

@@ -1293,16 +1293,18 @@ Blockly.BlockSvg.prototype.renderDrawRight_ = function(renderInfo, connectionsXY
}
renderInfo.curY += row.height;
}
if (this.block_.tray) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's no change to the logic here, I just think this is a little more readable.
this.block_.miniFlyout will be truthy for any block that has a minitoolbox, regardless of whether it's open. this.block_.tray (renamed to this.block_.isMiniFlyoutOpen) is true if the flyout is open.
so before it was

if (flyout is open) {
  show()
} else if (there is a flyout) {
  hide()
}

And now it is

if (there is a flyout) {
  if (it's open) {
    show()
  } else {
    hide()
  }
}

@codecov-commenter
Copy link

Codecov Report

Merging #228 into master will decrease coverage by 0.01%.
The diff coverage is 5.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #228      +/-   ##
==========================================
- Coverage   59.46%   59.45%   -0.02%     
==========================================
  Files          95       95              
  Lines       11697    11699       +2     
==========================================
  Hits         6956     6956              
- Misses       4741     4743       +2     
Impacted Files Coverage Δ
core/ui/block.js 71.07% <0.00%> (-0.13%) ⬇️
core/ui/block_svg/block_svg.js 83.50% <16.66%> (-0.15%) ⬇️
core/ui/block_space/block_space.js 65.82% <0.00%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d804ed...f4ddac1. Read the comment docs.

@ajpal ajpal merged commit 441fc1b into master Jun 24, 2020
@ajpal ajpal deleted the jun24-miniFlyout-open branch June 29, 2020 21:47
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

3 participants