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

Only add a hat if there's no output connection #3280

Merged
merged 4 commits into from
Oct 17, 2019

Conversation

samelhusseini
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Resolves

Fixes #3279

Proposed Changes

Only add a hat if there's no output connection

Reason for Changes

Rendering fix.

Test Coverage

Tested on the playground by changing the Blockly.BlockSvg.START_HAT = true

Tested on:

  • Desktop Chrome

Documentation

Additional Information

Copy link
Collaborator

@rachel-fenichel rachel-fenichel left a comment

Choose a reason for hiding this comment

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

LGTM with or without the suggested tweak.

@@ -266,7 +267,7 @@ Blockly.blockRendering.RenderInfo.prototype.populateTopRow_ = function() {
new Blockly.blockRendering.RoundCorner(this.constants_));
}

if (hasHat) {
if (hasHat && !hasOutputConnection) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would fold the !hasOutputConnection into the definition of hasHat.

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 actually more going on here. We should also consider whether we're connected to a block. eg, this is what you get:

Screen Shot 2019-10-17 at 9 22 26 AM

Copy link
Collaborator

Choose a reason for hiding this comment

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

no prev, no output, and start hat is set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Since we're checking for start hat in multiple places, thoughts on moving that check onto the block? block.hasHat()?

Screen Shot 2019-10-17 at 9 41 32 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually if we want renderers to be able to change this behaviour we probably shouldn't.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is still wrong--the top repeat block should not have a hat. The check is whether there's a previous connection, not whether there's a previous block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, misunderstanding on my part. Updated to only show when there's no previous connection and no output connection.

@RoboErikG
Copy link
Contributor

RoboErikG commented Oct 17, 2019

Why do we want unconnected blocks with previous connections to have a hat? That's still a change in behavior.

Edit: What Rachel said. I didn't see her comment when I added this one.

@samelhusseini
Copy link
Contributor Author

Yes that’s a misunderstanding on my part of what that property is meant to affect. Will update to only show the start hat if there’s no previous connection and no output connection.

core/renderers/measurables/rows.js Outdated Show resolved Hide resolved
@samelhusseini samelhusseini merged commit 36524a3 into google:develop Oct 17, 2019
@samelhusseini samelhusseini deleted the fix_starthat branch October 17, 2019 19:08
rachel-fenichel pushed a commit to rachel-fenichel/blockly that referenced this pull request Oct 17, 2019
…google#3280)

* Only add a hat if there's no output connection or previous connection
rachel-fenichel added a commit that referenced this pull request Oct 17, 2019
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.

3 participants