You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would prefer that as well. I wanted to leave the types as is round corner instead of adding the left, as there's a few places that check the type directly rather than using the base method isRoundCorner.
In terms of dealing with types, here are a few options:
do what we're doing now, con with that is that the check method is on the measurable, ie: to add additional types you have to do them in base measurable, otherwise elem.isSpecialType() might not exist on all elements.
factory type checker, something like: Blockly.isSpecialType(elem) that gets passed in an element and checks the type. This can be extended independently in each renderer to types that only matter there.
Use a enum flag and bitwise operations with types. This is the option I prefer, but it might be an overkill. We could have a central place to register types, which basically internally appends new types to a enum flag. Then you can do things like:
if (elem.type & Blockly.Measurable.Types['left row']) {
}
The nice thing about enum flags is you can have union types, so you can do bitwise checks to find if an element is a corner (not really caring about the specific type of corner it is), but then again you could always just do indexOf('corner') haha.
A combination of 2 and 3 would be nice too.
The text was updated successfully, but these errors were encountered:
Right now Measurables are checked with a combination of string equality tests against the
type
property and calls toisCorner()
,isInput()
, etc.We need to pick a standard approach and use it everywhere.
From discussion with @samelhusseini :
The text was updated successfully, but these errors were encountered: