-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
262 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface UserToolAreaStateObjectImpl | ||
{ | ||
state: "fixed" | "move"; | ||
offsetLeft: number; | ||
offsetTop: number; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/js/tool/application/ToolArea/service/ToolAreaActiveMouseUpService.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { $setCursor } from "../../../../util/Global"; | ||
import { execute } from "./ToolAreaActiveMouseUpService"; | ||
|
||
describe("ToolAreaActiveMouseUpServiceTest", () => | ||
{ | ||
test("execute test", async () => | ||
{ | ||
$setCursor("move"); | ||
expect(document.documentElement.style.getPropertyValue("--tool-cursor")).toBe("move"); | ||
|
||
const mockEvent = { | ||
"stopPropagation": () => { return null } | ||
}; | ||
|
||
execute(mockEvent); | ||
expect(document.documentElement.style.getPropertyValue("--tool-cursor")).toBe("auto"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/js/tool/application/ToolArea/usecase/ToolAreaInitializeSetActiveStateUseCase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { execute as userToolAreaStateGetService } from "../../../../user/application/service/UserToolAreaStateGetService"; | ||
import { execute as toolAreaChageStyleToActiveService } from "../service/ToolAreaChageStyleToActiveService"; | ||
import { UserToolAreaStateObjectImpl } from "../../../../interface/UserToolAreaStateObjectImpl"; | ||
import { $setToolAreaState } from "../../ToolUtil"; | ||
|
||
/** | ||
* @description ツールエリアの初期起動時に前回の移動状態をセット | ||
* Set previous move state at initial startup of tool area | ||
* | ||
* @param {HTMLElement} element | ||
* @return {void} | ||
* @method | ||
* @public | ||
*/ | ||
export const execute = (element: HTMLElement): void => | ||
{ | ||
// 移動していれば移動位置にElementを移動 | ||
const UserAreaToolState: UserToolAreaStateObjectImpl = userToolAreaStateGetService(); | ||
if (UserAreaToolState.state === "move") { | ||
|
||
// ツールエリアの状態を移動状態に更新 | ||
$setToolAreaState("move"); | ||
|
||
// ツールエリアのstyleを移動用に更新 | ||
toolAreaChageStyleToActiveService(element); | ||
|
||
// Elementを移動位置にセット | ||
element.style.left = `${UserAreaToolState.offsetLeft}px`; | ||
element.style.top = `${UserAreaToolState.offsetTop}px`; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/js/user/application/service/UserToolAreaStateGetService.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { UserToolAreaStateObjectImpl } from "../../../interface/UserToolAreaStateObjectImpl"; | ||
import { execute } from "./UserToolAreaStateGetService"; | ||
|
||
describe("UserToolAreaStateGetServiceTest", () => | ||
{ | ||
test("execute test", () => | ||
{ | ||
const object: UserToolAreaStateObjectImpl = execute(); | ||
expect(object.state).toBe("fixed"); | ||
expect(object.offsetLeft).toBe(0); | ||
expect(object.offsetTop).toBe(0); | ||
}); | ||
}); |
25 changes: 25 additions & 0 deletions
25
src/js/user/application/service/UserToolAreaStateGetService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { $USER_TOOL_AREA_STATE_KEY } from "../../../config/Config"; | ||
import { UserToolAreaStateObjectImpl } from "../../../interface/UserToolAreaStateObjectImpl"; | ||
|
||
/** | ||
* @description ツールエリアの移動状態をLocalStorageから取得 | ||
* Get tool area movement status from LocalStorage | ||
* | ||
* @return {object} | ||
* @method | ||
* @public | ||
*/ | ||
export const execute = (): UserToolAreaStateObjectImpl => | ||
{ | ||
const json: string | null = localStorage.getItem($USER_TOOL_AREA_STATE_KEY); | ||
|
||
if (json) { | ||
return JSON.parse(json) as UserToolAreaStateObjectImpl; | ||
} | ||
|
||
return { | ||
"state": "fixed", | ||
"offsetLeft": 0, | ||
"offsetTop": 0 | ||
}; | ||
}; |
Oops, something went wrong.