Today's Picture of the Day
Since only one dialog appears at a time, I'm thinking it's better to manage them by name rather than by individual boolean.
type TDialog = "" | "AddFusen";
ts
const AddFusenDialog = () => {
const [dialog, setDialog] = useGlobal("dialog");
const open = dialog === "AddFusen";
const onClose = () => {
setDialog("");
};
return (
<Dialog open={open} fullWidth={true} fullScreen={true} onClose={onClose}>
...
ts
describe("dialog", () => {
beforeEach(() => {
cy.visit("/");
});
it("main", () => {
cy.contains("Add Fusens").should("not.exist");
cy.updateGlobal((g) => {
g.dialog = "AddFusen";
});
cy.contains("Add Fusens").should("exist");
cy.contains("Close").click();
cy.contains("Add Fusens").should("not.exist");
});
});
By the way, do you want to use Fusen as the name to show to users or not?
Strong will not to let the menu bar monopolize valuable screen space...
menu
Menus appear on sticky notes.
I didn't like it, so I fixed it.
I feel this should be the default behavior.
I can't specify where to show the menu, so I'm moving the invisible div to the mouse position.
After reading knee-swing (gymnastics) again, I realized that what I'm making is more like the Kozane method than the KJ method.
KJ method... The KJ method is highly regarded as a method of "gathering the collective knowledge" of multiple people, and seems to be put to practical use by various companies. The Kozane method, which I have introduced here, is a closed-door intellectual production technique for a few individuals, and belongs to a relatively simple and elementary technique in Kawakita's system. In Kawakita's system, it is almost the same as what is called "KJ method B" writing.
drag/drop
I implemented a coordinate system transformation but it is difficult to test. The following does not work test.ts
cy.testid("2").should(
"hasPosition",
movidea.world_to_screen([top, left])
);
This is because the coordinate transformation is processed first at time T1. Even if we retry asynchronously later, it is meaningless because the "target value" has been calculated and fixed earlier. test.ts
cy.testid("2").should(
"hasPosition",
T1
);
To retry the coordinate calculation itself... I thought about it and put it in then. test.ts
cy.testid("2").then((el) => {
return cy
.wrap(el)
.should("hasPosition", movidea.world_to_screen([top, left]));
This still doesn't work if the last state update is asynchronous, I had set the default asynchronous, but decided to make it default synchronous and only specify the option when asynchronous is needed, for some reason, all tests passed even with synchronous.
Postscript of the next day
When dragging by grabbing off-center, the second drag is inexplicably misaligned, or the center drag, which is supposed to return to the original position, does not return to the original position at all.
Can now grab and drag off center.
This page is auto-translated from /nishio/2021-07-15Movidea開発日記 using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.