Skip to content

Commit

Permalink
#147 固定値をConfigに集約
Browse files Browse the repository at this point in the history
  • Loading branch information
ienaga committed Oct 16, 2023
1 parent a43461c commit bac90e0
Show file tree
Hide file tree
Showing 46 changed files with 230 additions and 100 deletions.
File renamed without changes.
Empty file.
7 changes: 7 additions & 0 deletions src/js/config/LibraryConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @description ライブラリのプレビューエリアのElementのID
*
* @type {string}
* @constant
*/
export const $LIBRARY_PREVIEW_AREA_ID: string = "library-preview-area";
File renamed without changes.
26 changes: 26 additions & 0 deletions src/js/config/ScreenConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @description ステージのElementのID
* ID of the Element of the stage
*
* @type {string}
* @constant
*/
export const $SCREEN_STAGE_ID: string = "stage";

/**
* @description ステージエリアのElementのID
* ID of Element in Stage Area
*
* @type {string}
* @constant
*/
export const $SCREEN_STAGE_AREA_ID: string = "stage-area";

/**
* @description スクリーンエリアのElementのID
* ID of the Element in the screen area
*
* @type {string}
* @constant
*/
export const $SCREEN_ID: string = "screen";
80 changes: 80 additions & 0 deletions src/js/config/StageSettingConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* @description ステージの横幅の初期値
* Default stage width
*
* @type {number}
* @constant
*/
export const $STAGE_DEFAULT_WIDTH: number = 550;

/**
* @description ステージの高さの初期値
* Default stage height
*
* @type {number}
* @constant
*/
export const $STAGE_DEFAULT_HEIGHT: number = 400;

/**
* @description ステージのフレームレートの初期値
* Default stage frame rate
*
* @type {number}
* @constant
*/
export const $STAGE_DEFAULT_FPS: number = 24;

/**
* @description ステージの初期背景色
* Initial background color of the stage
*
* @type {string}
* @constant
*/
export const $STAGE_DEFAULT_COLOR: string = "#ffffff";

/**
* @description ステージの幅のElementのID
* ID of Element of Stage Width
*
* @type {string}
* @constant
*/
export const $STAGE_WIDTH_ID: string = "stage-width";

/**
* @description ステージの高さのElementのID
* ID of Element of Stage Height
*
* @type {string}
* @constant
*/
export const $STAGE_HEIGHT_ID: string = "stage-height";

/**
* @description ステージのFPS設定のElementのID
* ID of the Element of the FPS setting of the stage
*
* @type {string}
* @constant
*/
export const $STAGE_FPS_ID: string = "stage-fps";

/**
* @description ステージの背景色のElementのID
* ID of the Element of the stage background color
*
* @type {string}
* @constant
*/
export const $STAGE_BG_COLOR_ID: string = "stage-bgColor";

/**
* @description ステージの幅高さのロックのElementのID
* ID of Element of Stage Width Height Lock
*
* @type {string}
* @constant
*/
export const $STAGE_LOCK_ID: string = "stage-lock";
17 changes: 17 additions & 0 deletions src/js/config/TimelineConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @description タイムラインの高さの初期値
* Default height of timeline
*
* @type {number}
* @constant
*/
export const $TIMELINE_DEFAULT_HEIGHT_SIZE: number = 280;

/**
* @description タイムラインのラベル設定のElementのID
* ID of the Element for the timeline label setting
*
* @type {string}
* @constant
*/
export const $TIMELINE_LABEL_NAME: string = "label-name";
8 changes: 8 additions & 0 deletions src/js/const/ToolConfig.ts → src/js/config/ToolConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,11 @@ export const $TOOL_ZOOM_PLUS_NAME: string = "zoom-plus";
*/
export const $TOOL_USER_SETTING_ID: string = `${$TOOL_PREFIX}-${$TOOL_USER_SETTING_NAME}`;

/**
* @description スクリーンの拡大縮小値のElementのID
* ID of the Element for the screen scaling value
*
* @type {string}
* @constant
*/
export const $SCREEN_SCALE_ID: string = "screen-scale";
35 changes: 0 additions & 35 deletions src/js/const/StageConfig.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/js/const/TimelineConfig.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { $LIBRARY_PREVIEW_AREA_ID } from "../../../config/LibraryConfig";

/**
* @description ライブラリのプレビューエリアの背景色を更新
* Updated background color of library preview area
Expand All @@ -10,7 +12,7 @@
export const execute = (color: string): void =>
{
const element: HTMLElement | null = document
.getElementById("library-preview-area");
.getElementById($LIBRARY_PREVIEW_AREA_ID);

if (!element) {
return ;
Expand Down
17 changes: 12 additions & 5 deletions src/js/controller/application/service/StageSettingUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { Stage } from "../../../core/model/Stage";
import {
$STAGE_BG_COLOR_ID,
$STAGE_FPS_ID,
$STAGE_HEIGHT_ID,
$STAGE_LOCK_ID,
$STAGE_WIDTH_ID
} from "../../../config/StageSettingConfig";

/**
* @description ステージ設定の各値を更新
Expand All @@ -12,35 +19,35 @@ import { Stage } from "../../../core/model/Stage";
export const execute = (stage: Stage): void =>
{
const stageWidth: HTMLInputElement | null = document
.getElementById("stage-width") as HTMLInputElement;
.getElementById($STAGE_WIDTH_ID) as HTMLInputElement;

if (stageWidth) {
stageWidth.value = `${stage.width}`;
}

const stageHeight: HTMLInputElement | null = document
.getElementById("stage-height") as HTMLInputElement;
.getElementById($STAGE_HEIGHT_ID) as HTMLInputElement;

if (stageHeight) {
stageHeight.value = `${stage.height}`;
}

const stageFps: HTMLInputElement | null = document
.getElementById("stage-fps") as HTMLInputElement;
.getElementById($STAGE_FPS_ID) as HTMLInputElement;

if (stageFps) {
stageFps.value = `${stage.fps}`;
}

const stageBgColor: HTMLInputElement | null = document
.getElementById("stage-bgColor") as HTMLInputElement;
.getElementById($STAGE_BG_COLOR_ID) as HTMLInputElement;

if (stageBgColor) {
stageBgColor.value = stage.bgColor;
}

const stageLock: HTMLElement | null = document
.getElementById("stage-lock");
.getElementById($STAGE_LOCK_ID);

if (stageLock && stageLock.children.length) {
stageLock
Expand Down
11 changes: 11 additions & 0 deletions src/js/core/model/Layer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @description タイムラインのレイヤー状態管理クラス
* Timeline layer state management class
*
* @class
* @public
*/
export class Layer
{

}
8 changes: 8 additions & 0 deletions src/js/core/model/MovieClip.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { Instance } from "./Instance";

/**
* @description MovieClipの状態管理クラス
* MovieClip state management class
*
* @class
* @public
* @extends {Instance}
*/
export class MovieClip extends Instance
{

Expand Down
38 changes: 19 additions & 19 deletions src/js/core/model/Stage.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { StageObjectImpl } from "../../interface/StageObjectImpl";
import { execute as stageInitializeUseCase } from "../usecase/StageInitializeUsecase";
import { execute as stageInitializeUseCase } from "../usecase/StageInitializeUseCase";
import { $clamp } from "../../util/Global";
import {
STAGE_DEFAULT_FPS,
STAGE_DEFAULT_HEIGHT,
STAGE_DEFAULT_WIDTH,
STAGE_DEFAULT_COLOR
} from "../../const/StageConfig";
$STAGE_DEFAULT_FPS,
$STAGE_DEFAULT_HEIGHT,
$STAGE_DEFAULT_WIDTH,
$STAGE_DEFAULT_COLOR
} from "../../config/StageSettingConfig";

/**
* @description スクリーンエリアのステージの管理クラス
Expand All @@ -31,35 +31,35 @@ export class Stage
{
/**
* @type {number}
* @default STAGE_DEFAULT_WIDTH
* @default $STAGE_DEFAULT_WIDTH
* @private
*/
this._$width = STAGE_DEFAULT_WIDTH;
this._$width = $STAGE_DEFAULT_WIDTH;

/**
* @type {number}
* @default STAGE_DEFAULT_HEIGHT
* @default $STAGE_DEFAULT_HEIGHT
* @private
*/
this._$height = STAGE_DEFAULT_HEIGHT;
this._$height = $STAGE_DEFAULT_HEIGHT;

/**
* @type {number}
* @default STAGE_DEFAULT_FPS
* @default $STAGE_DEFAULT_FPS
* @private
*/
this._$fps = STAGE_DEFAULT_FPS;
this._$fps = $STAGE_DEFAULT_FPS;

/**
* @type {number}
* @default STAGE_DEFAULT_COLOR
* @default $STAGE_DEFAULT_COLOR
* @private
*/
this._$bgColor = STAGE_DEFAULT_COLOR;
this._$bgColor = $STAGE_DEFAULT_COLOR;

/**
* @type {boolean}
* @default STAGE_DEFAULT_WIDTH
* @default false
* @private
*/
this._$lock = false;
Expand All @@ -70,7 +70,7 @@ export class Stage
* Stage display width
*
* @member {number}
* @default STAGE_DEFAULT_WIDTH
* @default $STAGE_DEFAULT_WIDTH
* @public
*/
get width (): number
Expand All @@ -87,7 +87,7 @@ export class Stage
* Stage display height
*
* @member {number}
* @default STAGE_DEFAULT_HEIGHT
* @default $STAGE_DEFAULT_HEIGHT
* @public
*/
get height (): number
Expand All @@ -104,7 +104,7 @@ export class Stage
* Set the stage drawing speed.
*
* @member {number}
* @default STAGE_DEFAULT_FPS
* @default $STAGE_DEFAULT_FPS
* @public
*/
get fps (): number
Expand All @@ -121,7 +121,7 @@ export class Stage
* Setting the background color of the stage
*
* @return {string}
* @default STAGE_DEFAULT_COLOR
* @default $STAGE_DEFAULT_COLOR
* @public
*/
get bgColor (): string
Expand Down
Loading

0 comments on commit bac90e0

Please sign in to comment.