-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix: zelos full block fields rendering badly #7490
fix: zelos full block fields rendering badly #7490
Conversation
Broke something with colour fields, will reopen in a sec. |
@@ -797,7 +809,7 @@ export abstract class Field<T = any> | |||
const xOffset = | |||
margin !== undefined | |||
? margin | |||
: this.borderRect_ | |||
: !this.isFullBlockField() | |||
? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no action required, but i wish the formatter would scooch these lines over because this stacked ternary operator makes me sad :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the question is: do you want your stacked ternary formatted as if it is:
if (cond1) {
consequent1;
} else if (cond2) {
consequent2;
} else {
consequent3;
}
or as if it is:
if (cond1) {
consequent1;
} else
if (cond2) {
consequent2;
} else {
consequent3;
}
I would not say the latter style is particularly popular.
core/block.ts
Outdated
let nFields = 0; | ||
for (const input of this.inputList) { | ||
if (input.connection) return false; | ||
// TODO: This comment is innacurate. Not sure what we want the spec to be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could just fix the comment. i assume by "text" it means "label" but it doesn't actually make sense to exclude those? like the full block rendering wouldn't make sense if there was a label. so i'd just update the comment.
The basics
The details
Resolves
Fixes #7442
Proposed Changes
Makes it so that input fields (and subclasses) and colour fields properly switch back and forth between full block fields and normal fields when their blocks are modified.
Reason for Changes
Before they didn't have the ability to switch, so mutated blocks would break.
Test Coverage
Manually tested the following behaviors using the browser console for number inputs and colour fields:
I think this would be a good candidate for screen shot testing. The code is so jank and I don't think unit testing is worthwhile.
Documentation
N/A
Additional Information
I disagree with most of how full block fields were implemented, so I've added inline docs discouraging people from using these parts of the API. But they should now approximately work under most circumstances.
Also need to update the colour field in samples, working on that now.