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 had previously mentioned in a pull request that traits of type color do not work. At the time I didn't have a need for them, but now I do so I'd like to look into fixing it if you haven't already started on it. The bug is in the InputColor object when it calls model.setValueFromInput - traits don't have that method so it throws an error. What do you think is the best way to fix this? Does the Trait object need a setValueFromInput method? Or should InputColor change so that it's smart enough to call different methods for a Trait vs a Property? Perhaps something else?
My initial (hacky) experimentation show that changing all of the model.setValueFromInput lines in InputColor to this gets it pretty close to working...not sure if this is the right path to go down or not though: model.setValueFromInput && model.setValueFromInput(cl, 0) || model.setTargetValue && model.setTargetValue(cl);
The text was updated successfully, but these errors were encountered:
Does the Trait object need a setValueFromInput method?
This leads to the duplication of code but still think this will gonna work better
// in Trait.jssetValueFromInput(value,final=1,opts={}){consttoSet={ value };this.set(toSet,{ ...opts,avoidStore: 1});// Have to trigger the changeif(final){this.set('value','',opts);this.set(toSet,opts);}},
moreover setTargetValue it's not actually a correct way because you have to update the model first (a listener will update the target later)
The real problem is a bad design from the start. To be correct I should have inside 'abstract/ui' an InputModel and its InputView (same for other types of input), then using them inside traits and styles. Basically, the structure has to be closer to what is done with properties inside style manager but there is a little bit more work to do -.-
Hi @artf,
I had previously mentioned in a pull request that traits of type
color
do not work. At the time I didn't have a need for them, but now I do so I'd like to look into fixing it if you haven't already started on it. The bug is in theInputColor
object when it callsmodel.setValueFromInput
- traits don't have that method so it throws an error. What do you think is the best way to fix this? Does theTrait
object need asetValueFromInput
method? Or shouldInputColor
change so that it's smart enough to call different methods for a Trait vs a Property? Perhaps something else?My initial (hacky) experimentation show that changing all of the
model.setValueFromInput
lines inInputColor
to this gets it pretty close to working...not sure if this is the right path to go down or not though:model.setValueFromInput && model.setValueFromInput(cl, 0) || model.setTargetValue && model.setTargetValue(cl);
The text was updated successfully, but these errors were encountered: