-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make (equivalent for) dragAndMoveBall available again #15
Conversation
This reverts commit 12c7f53.
Background ==== When I first play with brick-block-anywhere on [my website](https://the.igreque.info/), I found a bug that could be a good chance for me to learn the browser's behavior. This feature is very useful for reproducing the bug and testing after fixing it. Changes Summary ==== - Add a function `controlBallByMouse` to move the ball by mouse so that we can easily put the ball at some place for debugging. - Abstract the procedure to move the ball (`updateBallPositionBy` and `updateBallPositionTo`) to hide the details and for consistency. - Merge `TestMessage` into `StartMessage` because now the non-debugging mode has to know whether the debugging mode is enabled to disable the default movement of the ball. - Bonus: this change also makes canalun@12c7f53 unnecessary. It's simpler! Next ==== - More customizable debugging mode: make `controlMode` and `visualizeBlocks` separately configurable on popup.html. - Refactor: apply `updateBallPositionTo` to other objects if possible and it deserves.
src/game/configuration/settings.ts
Outdated
sound: boolean, | ||
visualizeBlocks: boolean, | ||
controlMode: "normal" | "mouse" | ||
} |
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.
[imo] How about a structure like this?👀 I think it might be more robust.
sound: boolean, | |
visualizeBlocks: boolean, | |
controlMode: "normal" | "mouse" | |
} | |
sound: boolean | |
} & { | |
visualizeBlocks: false, | |
controlMode: "normal" | |
} | { | |
visualizeBlocks: true, | |
controlMode: "mouse" | |
} |
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'm undecided about this.
I found two bugs using the controlMode: "mouse"
feature. I actually couldn't find one of the bugs actually because the borders drawn by visualizeBlocks
prevent me from reproducing it. That's why I left the TODO "More customizable debugging mode: make controlMode and visualizeBlocks separately configurable on popup.html.".
But now, I know how to fix it and the change to fix it would perhaps remove the root problem of visualizeBlocks
. So separating them could just make the code more complex.
I beg your opinion!
NOTE: I'll send another PR to fix the bug mentioned here today or tomorrow!
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.
Rethinking this problem, now I want to keep as is.
- As my need for separating the debug options has already been satisfied by (manually editing the code), we would rarely need to switch them independently. So keep popup.tsx simple by not adding new
<input>
s for the time being. - But IMO
visualizeBlocks
andcontrolMode
are essentially different. They should be configured independently (even by temporarily updating the code). Your suggestion makes it a little harder to do that.
src/game/configuration/settings.ts
Outdated
controlMode: "normal" | "mouse" | ||
} | ||
|
||
export function disableScoreboardIfDebug(options: StartOptions): StartOptions { |
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.
[Q] Is it possible to remove this function and make the scoreboard disabeld for the debug mode within sendMessageToIsolatedWorldOnActiveTabForTest()
in popup.tsx
? I'd like to hear your opnion :)
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.
👍 Indeed. I'm a little worried that'd make popup.tsx
complex, but more user-friendly!
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.
It seems I mistook your comment wrong 😅 . But 2614729 would surpass your expectation!
@igrep |
And I like your branch name :) |
Thank you! 😁 To tell the truth, I couldn't make up a good name for And the prefix "2" means it's just the second try 😅 . |
- Disable scoreboard on UI when the debug mode is enabled, then delete `disableScoreboardIfDebug`. - Answer to [a review comment from canalun](canalun#15 (comment)). - It seems I actually took the comment wrong, but this would make it easier to add independent debug options. - Abstract the common steps in `sendMessage*` functions. - Add the "Start" button to the bottom - This makes easier to start when enabling the debug mode.
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.
sorry for the delay. I'll review the other PRs also soon...!!
) : null} | ||
<br /> | ||
<button onClick={start}> Start! </button> |
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.
It seems that the start button is duplicated unnecessarily?👀
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.
As referred in 2614729, it's intentional.
I think now the settings menu is long enough that putting the start button both at the top and the bottom is a good choice.
Co-authored-by: canalun <[email protected]>
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.
thank you so much!!!!!
This is still draft because I left a several things below and I want to show you before completing to reduce the risk in case of refusal.FEEDBACK WELCOME!More customizable debugging mode: makeSee Make (equivalent for) dragAndMoveBall available again #15 (comment) on why I removed this.controlMode
andvisualizeBlocks
separately configurable on popup.html.updateBallPositionTo
to other objects if possible and it deserves.Background
When I first play with brick-block-anywhere on my website, I found a bug that could be a good chance for me to learn the browser's behavior. This feature is very useful for reproducing the bug and testing after fixing it.
Changes Summary
controlBallByMouse
to move the ball by mouse so that we can easily put the ball at some place for debugging.updateBallPositionBy
andupdateBallPositionTo
) to hide the details and for consistency.TestMessage
intoStartMessage
because now the non-debugging mode has to know whether the debugging mode is enabled to disable the default movement of the ball.Screenshot