Closed UtkarshSiddhpura closed 1 year ago
hey @UtkarshSiddhpura
I think the statement that count
is not stored in this.pawnClickEvent.count
is not accurate. While it's true that the count
parameter is stored in the detail
property of the event object, it's also accessible via the count
property of the event object itself. therefore, the code should work as expected, and there should not be any bugs caused by accessing this.pawnClickEvent.count
after the event is initialized.
The count
initialization in initCustomEvent
is not important.
What's matter is the work done in click event listener methods for items. The count
in these methods is set as the place expected by onAddClick
method. So, it's okay.
While it may not be crucial for the demo activity, providing information on where the initial event parameters are stored is important for the purpose of enabling anyone to easily implement a Sugarizer activity.
The fontSize value of text Always depends on its previous values
e.g fontSize+=2; or fontSize-=2; to increment/decrement sizes.
now if user will try to implement this logic using knowledge from tutorial:
this.eventName.initCustomEvent('btn-click', true, true, { fontSize: 16 });
//.... then on increment-fontsize button click:
that.eventName.fontSize += 2;
//here the fontSize is initially undefined not 16 (undefined + 2 initially)
that.eventName.detail.fontSize += 2; //Right Way
what do you think?
It's not a good idea to store the current font size in the event. It depends of the context, not of the palette. Have a look on the implementation of increase/decrease font in activities Write, LabyrinthJS or Story, you will see that the current font size always depend of the item so it's always store in the activity.
Ok! i get it now
Inside step8 of activity tutorial
The actual parameter
count
initialized here for pawnClickEvent https://github.com/llaske/sugarizer/blob/9630e2a2cbab435a65e2239bdac25b13a897a630/docs/tutorial/VueJS/step8.md?plain=1#L183is stored inside of
this.pawnClickEvent.detail.count
not inthis.pawnClickEvent.count
https://github.com/llaske/sugarizer/blob/9630e2a2cbab435a65e2239bdac25b13a897a630/docs/tutorial/VueJS/step8.md?plain=1#L191It may leads to bugs if someone wants to use previously initialized value. (e.g
this.pawnClickEvent.count += 3 // NaN
) as count is undefined initially