diff --git a/source/Behavior/Behavior.ts b/source/Behavior/Behavior.ts index 15c2dad..addd747 100644 --- a/source/Behavior/Behavior.ts +++ b/source/Behavior/Behavior.ts @@ -1,8 +1,8 @@ import { BehaviorRecorder, IAnyBehaviorRecorder } from "@Model/Behavior"; -import { Template } from "./Template"; -import { Dynamics } from "./Dynamics"; -import { Brownian } from "./Brownian"; -import { BoundaryConstraint } from "./BoundaryConstraint"; +import { Template } from "@Behavior/Template"; +import { Dynamics } from "@Behavior/Dynamics"; +import { Brownian } from "@Behavior/Brownian"; +import { BoundaryConstraint } from "@Behavior/BoundaryConstraint"; const AllBehaviors: IAnyBehaviorRecorder[] = [ new BehaviorRecorder(Template), diff --git a/source/Behavior/BoundaryConstraint.ts b/source/Behavior/BoundaryConstraint.ts index bf1cb59..32c7c71 100644 --- a/source/Behavior/BoundaryConstraint.ts +++ b/source/Behavior/BoundaryConstraint.ts @@ -1,12 +1,12 @@ import { Behavior } from "@Model/Behavior"; import { Group } from "@Model/Group"; import { Individual } from "@Model/Individual"; -import { Label } from "@Model/Label"; import { Model } from "@Model/Model"; import { Range } from "@Model/Range"; type IBoundaryConstraintBehaviorParameter = { - range: "LR" + range: "LR", + strength: "number" } type IBoundaryConstraintBehaviorEvent = {} @@ -27,6 +27,13 @@ class BoundaryConstraint extends Behavior rangeList[i].radius[1]; let oz = Math.abs(rz) > rangeList[i].radius[2]; - individual.applyForce( - ox ? rx : 0, - oy ? ry : 0, - oz ? rz : 0 - ) + if (ox || oy || oz) { + + let currentFLen = individual.vectorLength(rx, ry, rz); + if (currentFLen < fLen) { + fx = rx; + fy = ry; + fz = rz; + fLen = currentFLen; + } + + } else { + + fx = 0; + fy = 0; + fz = 0; + fLen = 0; + } } + + individual.applyForce( + fx * this.parameter.strength, + fy * this.parameter.strength, + fz * this.parameter.strength + ); } } diff --git a/source/Behavior/Dynamics.ts b/source/Behavior/Dynamics.ts index cb8c8fb..d41ef84 100644 --- a/source/Behavior/Dynamics.ts +++ b/source/Behavior/Dynamics.ts @@ -49,7 +49,7 @@ class Dynamics extends Behavior & {key: string, select?: boolean}; diff --git a/source/Component/HeaderBar/HeaderBar.tsx b/source/Component/HeaderBar/HeaderBar.tsx index fa605cf..c66a5fc 100644 --- a/source/Component/HeaderBar/HeaderBar.tsx +++ b/source/Component/HeaderBar/HeaderBar.tsx @@ -1,12 +1,11 @@ import { Component, ReactNode } from "react"; +import { Icon } from '@fluentui/react/lib/Icon'; import { useStatus, IMixinStatusProps } from "@Context/Status"; import { useSetting, IMixinSettingProps } from "@Context/Setting"; import { Theme, BackgroundLevel, FontLevel } from "@Component/Theme/Theme"; -import { Icon } from '@fluentui/react/lib/Icon'; -import { LocalizationTooltipHost } from "../Localization/LocalizationTooltipHost"; -import { I18N } from "../Localization/Localization"; +import { LocalizationTooltipHost } from "@Component/Localization/LocalizationTooltipHost"; +import { I18N } from "@Component/Localization/Localization"; import "./HeaderBar.scss"; -import { Tooltip, TooltipHost } from "@fluentui/react"; interface IHeaderBarProps { height: number; diff --git a/source/Component/LabelList/LabelList.tsx b/source/Component/LabelList/LabelList.tsx index ef077c2..c4c3839 100644 --- a/source/Component/LabelList/LabelList.tsx +++ b/source/Component/LabelList/LabelList.tsx @@ -1,7 +1,7 @@ import { Component, RefObject } from "react"; -import { Label } from "@Model/Label"; import { Icon } from "@fluentui/react"; import { useSetting, IMixinSettingProps, Themes } from "@Context/Setting"; +import { Label } from "@Model/Label"; import "./LabelList.scss"; interface ILabelListProps { diff --git a/source/Component/Localization/Localization.tsx b/source/Component/Localization/Localization.tsx index bc3c619..e627ae5 100644 --- a/source/Component/Localization/Localization.tsx +++ b/source/Component/Localization/Localization.tsx @@ -78,4 +78,4 @@ class Localization extends Component Component) | FunctionComponent; diff --git a/source/Context/Setting.tsx b/source/Context/Setting.tsx index f6ee558..2684e21 100644 --- a/source/Context/Setting.tsx +++ b/source/Context/Setting.tsx @@ -1,7 +1,7 @@ import { createContext } from "react"; -import { superConnect, superConnectWithEvent } from "./Context"; +import { superConnect, superConnectWithEvent } from "@Context/Context"; import { Emitter } from "@Model/Emitter"; -import { Layout } from "./Layout"; +import { Layout } from "@Context/Layout"; /** * 主题模式 diff --git a/source/Context/Status.tsx b/source/Context/Status.tsx index 42b5ba0..2bfa5d8 100644 --- a/source/Context/Status.tsx +++ b/source/Context/Status.tsx @@ -7,11 +7,12 @@ import { Group } from "@Model/Group"; import { Archive } from "@Model/Archive"; import { AbstractRenderer } from "@Model/Renderer"; import { ClassicRenderer, MouseMod } from "@GLRender/ClassicRenderer"; -import { Setting } from "./Setting"; +import { Setting } from "@Context/Setting"; import { I18N } from "@Component/Localization/Localization"; -import { superConnectWithEvent, superConnect } from "./Context"; -import { PopupController } from "./Popups"; -import { Behavior, IBehaviorParameter, IParamValue } from "@Model/Behavior"; +import { superConnectWithEvent, superConnect } from "@Context/Context"; +import { PopupController } from "@Context/Popups"; +import { Behavior } from "@Model/Behavior"; +import { IParameter, IParamValue } from "@Model/Parameter"; import { Actuator } from "@Model/Actuator"; function randomColor(unNormal: boolean = false) { @@ -208,7 +209,7 @@ class Status extends Emitter { /** * 修改群属性 */ - public changeBehaviorAttrib> + public changeBehaviorAttrib> (id: ObjectID, key: P, val: IParamValue, noParameter?: boolean) { const behavior = this.model.getBehaviorById(id); if (behavior) { diff --git a/source/Component/AttrInput/AttrInput.scss b/source/Input/AttrInput/AttrInput.scss similarity index 96% rename from source/Component/AttrInput/AttrInput.scss rename to source/Input/AttrInput/AttrInput.scss index e16f206..f265bc0 100644 --- a/source/Component/AttrInput/AttrInput.scss +++ b/source/Input/AttrInput/AttrInput.scss @@ -1,4 +1,4 @@ -@import "../Theme/Theme.scss"; +@import "../../Component/Theme/Theme.scss"; $line-min-height: 24px; diff --git a/source/Component/AttrInput/AttrInput.tsx b/source/Input/AttrInput/AttrInput.tsx similarity index 97% rename from source/Component/AttrInput/AttrInput.tsx rename to source/Input/AttrInput/AttrInput.tsx index eff6791..575f93c 100644 --- a/source/Component/AttrInput/AttrInput.tsx +++ b/source/Input/AttrInput/AttrInput.tsx @@ -1,8 +1,8 @@ import { Component, ReactNode } from "react"; import { Icon } from "@fluentui/react"; -import { Localization, AllI18nKeys } from "@Component/Localization/Localization"; +import { AllI18nKeys } from "@Component/Localization/Localization"; import { ObjectID } from "@Model/Renderer"; -import { TextField, ITextFieldProps } from "../TextField/TextField"; +import { TextField, ITextFieldProps } from "@Input/TextField/TextField"; import "./AttrInput.scss"; interface IAttrInputProps extends ITextFieldProps { diff --git a/source/Component/BehaviorPicker/BehaviorPicker.scss b/source/Input/BehaviorPicker/BehaviorPicker.scss similarity index 98% rename from source/Component/BehaviorPicker/BehaviorPicker.scss rename to source/Input/BehaviorPicker/BehaviorPicker.scss index 5f9b494..477985d 100644 --- a/source/Component/BehaviorPicker/BehaviorPicker.scss +++ b/source/Input/BehaviorPicker/BehaviorPicker.scss @@ -1,4 +1,4 @@ -@import "../Theme/Theme.scss"; +@import "../../Component/Theme/Theme.scss"; div.behavior-picker-list { width: 100%; diff --git a/source/Component/BehaviorPicker/BehaviorPicker.tsx b/source/Input/BehaviorPicker/BehaviorPicker.tsx similarity index 99% rename from source/Component/BehaviorPicker/BehaviorPicker.tsx rename to source/Input/BehaviorPicker/BehaviorPicker.tsx index 7e48ccc..7276dfd 100644 --- a/source/Component/BehaviorPicker/BehaviorPicker.tsx +++ b/source/Input/BehaviorPicker/BehaviorPicker.tsx @@ -1,11 +1,11 @@ -import { DetailsList } from "@Component/DetailsList/DetailsList"; import { Component, ReactNode, createRef } from "react"; -import { Behavior } from "@Model/Behavior"; import { Icon } from "@fluentui/react"; +import { Behavior } from "@Model/Behavior"; import { useSettingWithEvent, IMixinSettingProps } from "@Context/Setting"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; +import { DetailsList } from "@Component/DetailsList/DetailsList"; import { Localization } from "@Component/Localization/Localization"; -import { PickerList } from "@Component/PickerList/PickerList"; +import { PickerList } from "@Input/PickerList/PickerList"; import "./BehaviorPicker.scss"; interface IBehaviorPickerProps { diff --git a/source/Component/ColorInput/ColorInput.scss b/source/Input/ColorInput/ColorInput.scss similarity index 100% rename from source/Component/ColorInput/ColorInput.scss rename to source/Input/ColorInput/ColorInput.scss diff --git a/source/Component/ColorInput/ColorInput.tsx b/source/Input/ColorInput/ColorInput.tsx similarity index 97% rename from source/Component/ColorInput/ColorInput.tsx rename to source/Input/ColorInput/ColorInput.tsx index 8328d04..9d57dc4 100644 --- a/source/Component/ColorInput/ColorInput.tsx +++ b/source/Input/ColorInput/ColorInput.tsx @@ -1,6 +1,6 @@ import { Component, createRef, ReactNode } from "react"; -import { TextField, ITextFieldProps } from "@Component/TextField/TextField"; import { Callout, ColorPicker, DirectionalHint } from "@fluentui/react"; +import { TextField, ITextFieldProps } from "@Input/TextField/TextField"; import "./ColorInput.scss"; interface IColorInputProps extends ITextFieldProps { diff --git a/source/Component/ComboInput/ComboInput.scss b/source/Input/ComboInput/ComboInput.scss similarity index 94% rename from source/Component/ComboInput/ComboInput.scss rename to source/Input/ComboInput/ComboInput.scss index 3bc1d8c..01c730a 100644 --- a/source/Component/ComboInput/ComboInput.scss +++ b/source/Input/ComboInput/ComboInput.scss @@ -1,4 +1,4 @@ -@import "../Theme/Theme.scss"; +@import "../../Component/Theme/Theme.scss"; $line-min-height: 24px; diff --git a/source/Component/ComboInput/ComboInput.tsx b/source/Input/ComboInput/ComboInput.tsx similarity index 94% rename from source/Component/ComboInput/ComboInput.tsx rename to source/Input/ComboInput/ComboInput.tsx index baeb5e2..122cd78 100644 --- a/source/Component/ComboInput/ComboInput.tsx +++ b/source/Input/ComboInput/ComboInput.tsx @@ -1,7 +1,7 @@ import { Component, createRef, ReactNode } from "react"; -import { PickerList, IDisplayItem } from "../PickerList/PickerList"; -import { TextField, ITextFieldProps } from "../TextField/TextField"; import { Icon } from "@fluentui/react"; +import { PickerList, IDisplayItem } from "@Input/PickerList/PickerList"; +import { TextField, ITextFieldProps } from "@Input/TextField/TextField"; import { Localization } from "@Component/Localization/Localization"; import "./ComboInput.scss"; interface IComboInputProps extends ITextFieldProps { diff --git a/source/Component/LabelPicker/LabelPicker.scss b/source/Input/LabelPicker/LabelPicker.scss similarity index 64% rename from source/Component/LabelPicker/LabelPicker.scss rename to source/Input/LabelPicker/LabelPicker.scss index 6071264..0c87057 100644 --- a/source/Component/LabelPicker/LabelPicker.scss +++ b/source/Input/LabelPicker/LabelPicker.scss @@ -1,4 +1,4 @@ -@import "../Theme/Theme.scss"; +@import "../../Component/Theme/Theme.scss"; $line-min-height: 26px; diff --git a/source/Component/LabelPicker/LabelPicker.tsx b/source/Input/LabelPicker/LabelPicker.tsx similarity index 93% rename from source/Component/LabelPicker/LabelPicker.tsx rename to source/Input/LabelPicker/LabelPicker.tsx index 8b238ec..3ae8d11 100644 --- a/source/Component/LabelPicker/LabelPicker.tsx +++ b/source/Input/LabelPicker/LabelPicker.tsx @@ -1,9 +1,9 @@ -import { PickerList } from "../PickerList/PickerList"; -import { Label } from "@Model/Label"; -import { TextField, ITextFieldProps } from "../TextField/TextField"; -import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { Component, ReactNode, createRef } from "react"; -import { LabelList } from "../LabelList/LabelList"; +import { Label } from "@Model/Label"; +import { PickerList } from "@Input/PickerList/PickerList"; +import { TextField, ITextFieldProps } from "@Input/TextField/TextField"; +import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; +import { LabelList } from "@Component/LabelList/LabelList"; import "./LabelPicker.scss" interface ILabelPickerProps extends ITextFieldProps { diff --git a/source/Component/Message/Message.scss b/source/Input/Message/Message.scss similarity index 100% rename from source/Component/Message/Message.scss rename to source/Input/Message/Message.scss diff --git a/source/Component/Message/Message.tsx b/source/Input/Message/Message.tsx similarity index 100% rename from source/Component/Message/Message.tsx rename to source/Input/Message/Message.tsx index 56384da..8634d7d 100644 --- a/source/Component/Message/Message.tsx +++ b/source/Input/Message/Message.tsx @@ -1,6 +1,6 @@ +import { FunctionComponent } from "react"; import { AllI18nKeys, I18N } from "@Component/Localization/Localization"; import { useSettingWithEvent, IMixinSettingProps, Themes, Language } from "@Context/Setting"; -import { FunctionComponent } from "react"; import "./Message.scss"; interface IMessageProps { diff --git a/source/Component/ObjectPicker/ObjectPicker.scss b/source/Input/ObjectPicker/ObjectPicker.scss similarity index 96% rename from source/Component/ObjectPicker/ObjectPicker.scss rename to source/Input/ObjectPicker/ObjectPicker.scss index 9e202f7..30bc1ff 100644 --- a/source/Component/ObjectPicker/ObjectPicker.scss +++ b/source/Input/ObjectPicker/ObjectPicker.scss @@ -1,4 +1,4 @@ -@import "../Theme/Theme.scss"; +@import "../../Component/Theme/Theme.scss"; @import "../PickerList/RainbowBg.scss"; $line-min-height: 24px; diff --git a/source/Component/ObjectPicker/ObjectPicker.tsx b/source/Input/ObjectPicker/ObjectPicker.tsx similarity index 97% rename from source/Component/ObjectPicker/ObjectPicker.tsx rename to source/Input/ObjectPicker/ObjectPicker.tsx index f3940b5..4b7c49e 100644 --- a/source/Component/ObjectPicker/ObjectPicker.tsx +++ b/source/Input/ObjectPicker/ObjectPicker.tsx @@ -1,14 +1,14 @@ import { Component, createRef, ReactNode } from "react"; +import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { Label } from "@Model/Label"; import { Group } from "@Model/Group"; import { Range } from "@Model/Range"; -import { TextField, ITextFieldProps } from "../TextField/TextField"; -import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; -import { PickerList, IDisplayItem, getObjectDisplayInfo, IDisplayInfo } from "../PickerList/PickerList"; -import { Localization } from "@Component/Localization/Localization"; -import { Icon } from "@fluentui/react"; import { CtrlObject } from "@Model/CtrlObject"; import { Behavior } from "@Model/Behavior"; +import { TextField, ITextFieldProps } from "@Input/TextField/TextField"; +import { PickerList, IDisplayItem, getObjectDisplayInfo, IDisplayInfo } from "@Input/PickerList/PickerList"; +import { Localization } from "@Component/Localization/Localization"; +import { Icon } from "@fluentui/react"; import "./ObjectPicker.scss"; type IObjectType = Label | Group | Range | CtrlObject; diff --git a/source/Input/Parameter/Parameter.scss b/source/Input/Parameter/Parameter.scss new file mode 100644 index 0000000..e69de29 diff --git a/source/Input/Parameter/Parameter.tsx b/source/Input/Parameter/Parameter.tsx new file mode 100644 index 0000000..05697a2 --- /dev/null +++ b/source/Input/Parameter/Parameter.tsx @@ -0,0 +1,202 @@ +import { Component, Fragment, ReactNode } from "react"; +import { useSettingWithEvent, IMixinSettingProps, Language } from "@Context/Setting"; +import { AttrInput } from "@Input/AttrInput/AttrInput"; +import { ObjectID } from "@Model/Renderer"; +import { TogglesInput } from "@Input/TogglesInput/TogglesInput"; +import { ObjectPicker } from "@Input/ObjectPicker/ObjectPicker"; +import { AllI18nKeys } from "@Component/Localization/Localization"; +import { Message } from "@Input/Message/Message"; +import { + IParameter, IParameterOption, IParameterOptionItem, + IParameterValue, IParamValue, isObjectType, isVectorType +} from "@Model/Parameter"; +import "./Parameter.scss"; + +interface IParameterProps

{ + option: IParameterOption

; + value: IParameterValue

; + key: ObjectID; + change: (key: K, val: IParamValue) => any; + i18n: (option: IParameterOptionItem, language: Language) => string; + title?: AllI18nKeys; + titleOption?: Record; + isFirst?: boolean; +} + +@useSettingWithEvent("language") +class Parameter

extends Component & IMixinSettingProps> { + + private renderParameter + (key: K, option: IParameterOptionItem, value: IParamValue): ReactNode { + + const indexKey = `${this.props.key}-${key}`; + const type = option.type; + const i18nString = this.props.i18n(option, this.props.setting?.language ?? "EN_US"); + + if (type === "number") { + return ?? 0} + valueChange={(val) => { + this.props.change(key, parseFloat(val) as IParamValue); + }} + />; + } + + else if (type === "string") { + return ?? ""} + valueChange={(val) => { + this.props.change(key, val as IParamValue); + }} + />; + } + + else if (type === "boolean") { + return ?? false} + valueChange={(val) => { + this.props.change(key, val as IParamValue); + }} + /> + } + + else if (isObjectType(type)) { + + type IObjectParamValue = IParamValue<"G" | "R" | "LG" | "LR">; + const typedValue = value as IObjectParamValue; + + return { + typedValue.picker = obj as IObjectParamValue["picker"]; + this.props.change(key, typedValue as IParamValue); + }} + cleanValue={() => { + typedValue.picker = undefined as IObjectParamValue["picker"]; + this.props.change(key, typedValue as IParamValue); + }} + /> + } + + else if (isVectorType(type)) { + + type IObjectParamValue = IParamValue<"vec">; + const typedValue = value as IObjectParamValue; + + return + + { + typedValue[0] = parseFloat(val); + this.props.change(key, typedValue as IParamValue); + }} + /> + + { + typedValue[1] = parseFloat(val); + this.props.change(key, typedValue as IParamValue); + }} + /> + + { + typedValue[2] = parseFloat(val); + this.props.change(key, typedValue as IParamValue); + }} + /> + + + } + + else { + return + } + } + + private renderAllParameter(key: Array) { + return key.map((key) => { + return this.renderParameter( + key, + this.props.option[key], + this.props.value[key], + ); + }); + } + + public render(): ReactNode { + const allOptionKeys: Array = Object.getOwnPropertyNames(this.props.option); + + return <> + + { + allOptionKeys.length <= 0 && this.props.title ? + : null + } + + { + this.renderAllParameter(allOptionKeys) + } + + + } +} + +export { Parameter } \ No newline at end of file diff --git a/source/Component/PickerList/PickerList.scss b/source/Input/PickerList/PickerList.scss similarity index 100% rename from source/Component/PickerList/PickerList.scss rename to source/Input/PickerList/PickerList.scss diff --git a/source/Component/PickerList/PickerList.tsx b/source/Input/PickerList/PickerList.tsx similarity index 100% rename from source/Component/PickerList/PickerList.tsx rename to source/Input/PickerList/PickerList.tsx diff --git a/source/Component/PickerList/RainbowBg.scss b/source/Input/PickerList/RainbowBg.scss similarity index 100% rename from source/Component/PickerList/RainbowBg.scss rename to source/Input/PickerList/RainbowBg.scss diff --git a/source/Component/SearchBox/SearchBox.scss b/source/Input/SearchBox/SearchBox.scss similarity index 97% rename from source/Component/SearchBox/SearchBox.scss rename to source/Input/SearchBox/SearchBox.scss index a7636fd..7f585c8 100644 --- a/source/Component/SearchBox/SearchBox.scss +++ b/source/Input/SearchBox/SearchBox.scss @@ -1,4 +1,4 @@ -@import "../Theme/Theme.scss"; +@import "../../Component/Theme/Theme.scss"; $search-box-height: 26px; diff --git a/source/Component/SearchBox/SearchBox.tsx b/source/Input/SearchBox/SearchBox.tsx similarity index 100% rename from source/Component/SearchBox/SearchBox.tsx rename to source/Input/SearchBox/SearchBox.tsx index 07c3ceb..4c58bc9 100644 --- a/source/Component/SearchBox/SearchBox.tsx +++ b/source/Input/SearchBox/SearchBox.tsx @@ -1,8 +1,8 @@ +import { Component, ReactNode } from "react"; +import { Icon } from "@fluentui/react"; import { AllI18nKeys, I18N } from "@Component/Localization/Localization"; import { BackgroundLevel, FontLevel, Theme } from "@Component/Theme/Theme"; import { useSettingWithEvent, IMixinSettingProps } from "@Context/Setting"; -import { Icon } from "@fluentui/react"; -import { Component, ReactNode } from "react"; import "./SearchBox.scss"; interface ISearchBoxProps { diff --git a/source/Component/TextField/TextField.scss b/source/Input/TextField/TextField.scss similarity index 97% rename from source/Component/TextField/TextField.scss rename to source/Input/TextField/TextField.scss index 0f5cde7..8d7eea6 100644 --- a/source/Component/TextField/TextField.scss +++ b/source/Input/TextField/TextField.scss @@ -1,4 +1,4 @@ -@import "../Theme/Theme.scss"; +@import "../../Component/Theme/Theme.scss"; $line-min-height: 26px; diff --git a/source/Component/TextField/TextField.tsx b/source/Input/TextField/TextField.tsx similarity index 100% rename from source/Component/TextField/TextField.tsx rename to source/Input/TextField/TextField.tsx diff --git a/source/Component/TogglesInput/TogglesInput.scss b/source/Input/TogglesInput/TogglesInput.scss similarity index 95% rename from source/Component/TogglesInput/TogglesInput.scss rename to source/Input/TogglesInput/TogglesInput.scss index adb948c..aa3a48a 100644 --- a/source/Component/TogglesInput/TogglesInput.scss +++ b/source/Input/TogglesInput/TogglesInput.scss @@ -1,4 +1,4 @@ -@import "../Theme/Theme.scss"; +@import "../../Component/Theme/Theme.scss"; $line-min-height: 26px; diff --git a/source/Component/TogglesInput/TogglesInput.tsx b/source/Input/TogglesInput/TogglesInput.tsx similarity index 95% rename from source/Component/TogglesInput/TogglesInput.tsx rename to source/Input/TogglesInput/TogglesInput.tsx index bf96f22..87c27c8 100644 --- a/source/Component/TogglesInput/TogglesInput.tsx +++ b/source/Input/TogglesInput/TogglesInput.tsx @@ -1,6 +1,6 @@ -import { Icon } from "@fluentui/react"; import { Component, ReactNode } from "react"; -import { TextField, ITextFieldProps } from "../TextField/TextField"; +import { Icon } from "@fluentui/react"; +import { TextField, ITextFieldProps } from "@Input/TextField/TextField"; import "./TogglesInput.scss"; interface ITogglesInputProps extends ITextFieldProps { diff --git a/source/Localization/ZH-CN.ts b/source/Localization/ZH-CN.ts index add0744..8403f11 100644 --- a/source/Localization/ZH-CN.ts +++ b/source/Localization/ZH-CN.ts @@ -25,7 +25,7 @@ const ZH_CN = { "Input.Error.Length": "输入内容长度须小于 {number}", "Input.Error.Length.Less": "输入内容长度须大于 {number}", "Input.Error.Select": "选择对象 ...", - "Object.List.New.Group": "组对象 {id}", + "Object.List.New.Group": "群对象 {id}", "Object.List.New.Range": "范围对象 {id}", "Object.List.New.Label": "标签 {id}", "Object.List.No.Data": "模型中没有任何对象,点击按钮以创建", diff --git a/source/Model/Actuator.ts b/source/Model/Actuator.ts index 6c0e914..0417357 100644 --- a/source/Model/Actuator.ts +++ b/source/Model/Actuator.ts @@ -1,5 +1,5 @@ -import { Model } from "./Model"; -import { Emitter } from "./Emitter"; +import { Model } from "@Model/Model"; +import { Emitter } from "@Model/Emitter"; interface IActuatorEvent { startChange: boolean; diff --git a/source/Model/Archive.ts b/source/Model/Archive.ts index 8c91b21..963ae75 100644 --- a/source/Model/Archive.ts +++ b/source/Model/Archive.ts @@ -1,4 +1,4 @@ -import { Emitter, EventType, EventMixin } from "./Emitter"; +import { Emitter, EventType } from "@Model/Emitter"; interface IArchiveEvent { save: Archive; diff --git a/source/Model/Behavior.ts b/source/Model/Behavior.ts index 37618ff..1815f07 100644 --- a/source/Model/Behavior.ts +++ b/source/Model/Behavior.ts @@ -1,136 +1,16 @@ -import { IAnyObject } from "./Renderer"; -import { Emitter, EventType } from "./Emitter"; -import type { Individual } from "./Individual"; -import type { Group } from "./Group"; -import type { Model } from "./Model"; -import type { Range } from "./Range"; -import type { Label } from "./Label"; - -type IObjectParamCacheType = { - picker: P; - objects: Q; -} - -/** - * 参数类型 - */ -type IMapBasicParamTypeKeyToType = { - "number": number; - "string": string; - "boolean": boolean; -} - -type IMapObjectParamTypeKeyToType = { - "R": IObjectParamCacheType; - "G": IObjectParamCacheType; - "LR": IObjectParamCacheType

= { - [X in keyof P]: IBehaviorParameterOptionItem; -} - -/** - * 参数类型列表映射到参数对象 - */ -type IBehaviorParameterValue

= { - [X in keyof P]: IParamValue -} +import { Emitter, EventType } from "@Model/Emitter"; +import type { Individual } from "@Model/Individual"; +import type { Group } from "@Model/Group"; +import type { Model } from "@Model/Model"; +import { getDefaultValue, IParameter, IParameterOption, IParameterValue } from "@Model/Parameter"; /** * 行为构造函数类型 */ type IBehaviorConstructor< - P extends IBehaviorParameter = {}, + P extends IParameter = {}, E extends Record = {} -> = new (id: string, parameter: IBehaviorParameterValue

) => Behavior; +> = new (id: string, parameter: IParameterValue

) => Behavior; type IAnyBehavior = Behavior; type IAnyBehaviorRecorder = BehaviorRecorder; @@ -192,7 +72,7 @@ class BehaviorInfo = {}> extends Emitter { } class BehaviorRecorder< - P extends IBehaviorParameter = {}, + P extends IParameter = {}, E extends Record = {} > extends BehaviorInfo<{}> { @@ -221,62 +101,13 @@ class BehaviorRecorder< /** * 对象参数列表 */ - public parameterOption: IBehaviorParameterOption

; - - /** - * 获取参数列表的默认值 - */ - public getDefaultValue(): IBehaviorParameterValue

{ - let defaultObj = {} as IBehaviorParameterValue

; - for (let key in this.parameterOption) { - let defaultVal = this.parameterOption[key].defaultValue; - - defaultObj[key] = defaultVal as any; - if (defaultObj[key] === undefined) { - - switch (this.parameterOption[key].type) { - case "string": - defaultObj[key] = "" as any; - break; - - case "number": - defaultObj[key] = 0 as any; - break; - - case "boolean": - defaultObj[key] = false as any; - break; - - case "vec": - defaultObj[key] = [0, 0, 0] as any; - break; - - case "G": - case "R": - defaultObj[key] = { - picker: undefined, - objects: undefined - } as any; - break; - - case "LR": - case "LG": - defaultObj[key] = { - picker: undefined, - objects: [] - } as any; - break; - } - } - } - return defaultObj; - } + public parameterOption: IParameterOption

; /** * 创建一个新的行为实例 */ public new(): Behavior { - return new this.behavior(this.getNextId(), this.getDefaultValue()); + return new this.behavior(this.getNextId(), getDefaultValue(this.parameterOption)); } public constructor(behavior: IBehaviorConstructor) { @@ -297,7 +128,7 @@ class BehaviorRecorder< * 群体的某种行为 */ class Behavior< - P extends IBehaviorParameter = {}, + P extends IParameter = {}, E extends Record = {} > extends BehaviorInfo { @@ -325,14 +156,14 @@ class Behavior< /** * 行为参数 */ - public parameter: IBehaviorParameterValue

; + public parameter: IParameterValue

; /** * 对象参数列表 */ - public parameterOption: IBehaviorParameterOption

= {} as any; + public parameterOption: IParameterOption

= {} as any; - public constructor(id: string, parameter: IBehaviorParameterValue

) { + public constructor(id: string, parameter: IParameterValue

) { super(); this.id = id; this.parameter = parameter; @@ -416,8 +247,6 @@ class Behavior< type IRenderBehavior = BehaviorInfo | Behavior; export { - Behavior, BehaviorRecorder, IBehaviorParameterOption, IBehaviorParameterOptionItem, IParamValue, - IAnyBehavior, IAnyBehaviorRecorder, BehaviorInfo, IRenderBehavior, IBehaviorParameter, - isObjectType, isVectorType + Behavior, BehaviorRecorder, IAnyBehavior, IAnyBehaviorRecorder, BehaviorInfo, IRenderBehavior }; export default { Behavior }; \ No newline at end of file diff --git a/source/Model/CtrlObject.ts b/source/Model/CtrlObject.ts index a6e810e..5faa7e1 100644 --- a/source/Model/CtrlObject.ts +++ b/source/Model/CtrlObject.ts @@ -1,6 +1,6 @@ -import { LabelObject } from "./Label" -import type { Model } from "./Model"; -import type { ObjectID } from "./Renderer"; +import { LabelObject } from "@Model/Label" +import type { Model } from "@Model/Model"; +import type { ObjectID } from "@Model/Renderer"; /** * 可控对象 diff --git a/source/Model/Group.ts b/source/Model/Group.ts index 6942210..889043c 100644 --- a/source/Model/Group.ts +++ b/source/Model/Group.ts @@ -1,8 +1,8 @@ -import { Individual } from "./Individual"; -import { CtrlObject } from "./CtrlObject"; -import type { Behavior } from "./Behavior"; -import { Label } from "./Label"; -import { Range } from "./Range"; +import { Individual } from "@Model/Individual"; +import { CtrlObject } from "@Model/CtrlObject"; +import type { Behavior } from "@Model/Behavior"; +import { Label } from "@Model/Label"; +import { Range } from "@Model/Range"; enum GenMod { Point = "p", diff --git a/source/Model/Individual.ts b/source/Model/Individual.ts index 092edde..8f84077 100644 --- a/source/Model/Individual.ts +++ b/source/Model/Individual.ts @@ -1,5 +1,5 @@ -import type { Group } from "./Group"; -import { ObjectID } from "./Renderer"; +import type { Group } from "@Model/Group"; +import { ObjectID } from "@Model/Renderer"; /** * 群中的个体类型 diff --git a/source/Model/Label.ts b/source/Model/Label.ts index 3cdf609..21ae946 100644 --- a/source/Model/Label.ts +++ b/source/Model/Label.ts @@ -1,5 +1,5 @@ -import type { Model } from "./Model"; -import { ObjectID } from "./Renderer"; +import type { Model } from "@Model/Model"; +import { ObjectID } from "@Model/Renderer"; /** * 数据标签 diff --git a/source/Model/Model.ts b/source/Model/Model.ts index b7dbe1f..5b15d85 100644 --- a/source/Model/Model.ts +++ b/source/Model/Model.ts @@ -1,11 +1,12 @@ -import { Individual } from "./Individual"; -import { Group } from "./Group"; -import { Range } from "./Range"; -import { Emitter, EventType, EventMixin } from "./Emitter"; -import { CtrlObject } from "./CtrlObject"; -import { ObjectID, AbstractRenderer } from "./Renderer"; -import { Label } from "./Label"; -import { Behavior, IAnyBehavior, IAnyBehaviorRecorder, IParamValue } from "./Behavior"; +import { Label } from "@Model/Label"; +import { Group } from "@Model/Group"; +import { Range } from "@Model/Range"; +import { IParamValue } from "@Model/Parameter"; +import { Individual } from "@Model/Individual"; +import { CtrlObject } from "@Model/CtrlObject"; +import { Emitter, EventType, EventMixin } from "@Model/Emitter"; +import { ObjectID, AbstractRenderer } from "@Model/Renderer"; +import { Behavior, IAnyBehavior, IAnyBehaviorRecorder } from "@Model/Behavior"; type ModelEvent = { labelChange: Label[]; diff --git a/source/Model/Parameter.ts b/source/Model/Parameter.ts new file mode 100644 index 0000000..0d70ca4 --- /dev/null +++ b/source/Model/Parameter.ts @@ -0,0 +1,173 @@ +import type { Group } from "@Model/Group"; +import type { Range } from "@Model/Range"; +import type { Label } from "@Model/Label"; + +type IObjectParamCacheType = { + picker: P; + objects: Q; +} + +/** + * 参数类型 + */ +type IMapBasicParamTypeKeyToType = { + "number": number; + "string": string; + "boolean": boolean; +} + +type IMapObjectParamTypeKeyToType = { + "R": IObjectParamCacheType; + "G": IObjectParamCacheType; + "LR": IObjectParamCacheType

= { + [X in keyof P]: IParameterOptionItem; +} + +/** + * 参数类型列表映射到参数对象 + */ +type IParameterValue

= { + [X in keyof P]: IParamValue +} + +function getDefaultValue

(option: IParameterOption

): IParameterValue

{ + let defaultObj = {} as IParameterValue

; + for (let key in option) { + let defaultVal = option[key].defaultValue; + + if (defaultVal !== undefined) { + defaultObj[key] = defaultVal; + } else { + + switch (option[key].type) { + case "string": + defaultObj[key] = "" as any; + break; + + case "number": + defaultObj[key] = 0 as any; + break; + + case "boolean": + defaultObj[key] = false as any; + break; + + case "vec": + defaultObj[key] = [0, 0, 0] as any; + break; + + case "G": + case "R": + defaultObj[key] = { + picker: undefined, + objects: undefined + } as any; + break; + + case "LR": + case "LG": + defaultObj[key] = { + picker: undefined, + objects: [] + } as any; + break; + } + } + } + return defaultObj; +} + +export { + IParamType, IParamValue, isObjectType, isVectorType, getDefaultValue, + IParameterOptionItem, IParameter, IParameterOption, IParameterValue +} \ No newline at end of file diff --git a/source/Model/Range.ts b/source/Model/Range.ts index 5e7c1f3..f6a0191 100644 --- a/source/Model/Range.ts +++ b/source/Model/Range.ts @@ -1,4 +1,4 @@ -import { CtrlObject } from "./CtrlObject"; +import { CtrlObject } from "@Model/CtrlObject"; /** * 范围 diff --git a/source/Page/Laboratory/Laboratory.tsx b/source/Page/Laboratory/Laboratory.tsx index b98892f..e3eeb43 100644 --- a/source/Page/Laboratory/Laboratory.tsx +++ b/source/Page/Laboratory/Laboratory.tsx @@ -1,7 +1,7 @@ import { Component, ReactNode, createRef } from "react"; import { ClassicRenderer } from "@GLRender/ClassicRenderer"; -import { Entry } from "../Entry/Entry"; import { Model } from "@Model/Model"; +import { Entry } from "../Entry/Entry"; import "./Laboratory.scss"; class Laboratory extends Component { diff --git a/source/Page/SimulatorWeb/SimulatorWeb.tsx b/source/Page/SimulatorWeb/SimulatorWeb.tsx index 80e0b04..9e67110 100644 --- a/source/Page/SimulatorWeb/SimulatorWeb.tsx +++ b/source/Page/SimulatorWeb/SimulatorWeb.tsx @@ -1,16 +1,16 @@ import { Component, ReactNode } from "react"; import { SettingProvider, Setting } from "@Context/Setting"; -import { HeaderBar } from "@Component/HeaderBar/HeaderBar"; import { Theme, BackgroundLevel, FontLevel } from "@Component/Theme/Theme"; -import { Entry } from "../Entry/Entry"; import { StatusProvider, Status } from "@Context/Status"; import { ClassicRenderer } from "@GLRender/ClassicRenderer"; import { initializeIcons } from '@fluentui/font-icons-mdl2'; import { RootContainer } from "@Component/Container/RootContainer"; import { LayoutDirection } from "@Context/Layout"; -import { CommandBar } from "@Component/CommandBar/CommandBar"; -import { Popup } from "@Component/Popup/Popup"; import { AllBehaviors } from "@Behavior/Behavior"; +import { CommandBar } from "@Component/CommandBar/CommandBar"; +import { HeaderBar } from "@Component/HeaderBar/HeaderBar"; +import { Popup } from "@Component/Popup/Popup"; +import { Entry } from "../Entry/Entry"; import "./SimulatorWeb.scss"; initializeIcons("https://img.mrkbear.com/fabric-cdn-prod_20210407.001/"); @@ -63,7 +63,7 @@ class SimulatorWeb extends Component { brownian.name = "Brownian"; brownian.color = [200, 80, 250]; let boundary = this.status.model.addBehavior(AllBehaviors[3]); boundary.name = "Boundary"; boundary.color = [80, 200, 250]; - // boundary.parameter.range = this.status.model.allRangeLabel; + boundary.parameter.range.picker = this.status.model.allRangeLabel; group.addBehavior(template); group.addBehavior(dynamic); group.addBehavior(brownian); diff --git a/source/Panel/BehaviorDetails/BehaviorDetails.tsx b/source/Panel/BehaviorDetails/BehaviorDetails.tsx index 448c98c..7090ee8 100644 --- a/source/Panel/BehaviorDetails/BehaviorDetails.tsx +++ b/source/Panel/BehaviorDetails/BehaviorDetails.tsx @@ -1,13 +1,13 @@ -import { Component, Fragment, ReactNode} from "react"; +import { Component, ReactNode} from "react"; import { useSettingWithEvent, IMixinSettingProps } from "@Context/Setting"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; -import { Behavior, IBehaviorParameter, isObjectType, isVectorType } from "@Model/Behavior"; -import { Message } from "@Component/Message/Message"; -import { AttrInput } from "@Component/AttrInput/AttrInput"; -import { ColorInput } from "@Component/ColorInput/ColorInput"; -import { TogglesInput } from "@Component/TogglesInput/TogglesInput"; +import { IAnyBehavior } from "@Model/Behavior"; +import { Message } from "@Input/Message/Message"; +import { AttrInput } from "@Input/AttrInput/AttrInput"; +import { ColorInput } from "@Input/ColorInput/ColorInput"; +import { TogglesInput } from "@Input/TogglesInput/TogglesInput"; import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; -import { ObjectPicker } from "@Component/ObjectPicker/ObjectPicker"; +import { Parameter } from "@Input/Parameter/Parameter"; import "./BehaviorDetails.scss"; interface IBehaviorDetailsProps {} @@ -16,11 +16,24 @@ interface IBehaviorDetailsProps {} @useStatusWithEvent("focusBehaviorChange", "behaviorAttrChange") class BehaviorDetails extends Component { - private renderFrom - (behavior: Behavior>): ReactNode { - - const allParameterKeys = Object.getOwnPropertyNames(behavior.parameterOption); + private handelDeleteBehavior = (behavior: IAnyBehavior) => { + if (this.props.status) { + const status = this.props.status; + status.popup.showPopup(ConfirmPopup, { + infoI18n: "Popup.Delete.Behavior.Confirm", + titleI18N: "Popup.Action.Objects.Confirm.Title", + yesI18n: "Popup.Action.Objects.Confirm.Delete", + red: "yes", + yes: () => { + status.model.deleteBehavior(behavior); + status.setBehaviorObject(); + } + }) + } + } + private renderFrom(behavior: IAnyBehavior): ReactNode { + return <> @@ -44,145 +57,29 @@ class BehaviorDetails extends Component { - if (this.props.status) { - const status = this.props.status; - status.popup.showPopup(ConfirmPopup, { - infoI18n: "Popup.Delete.Behavior.Confirm", - titleI18N: "Popup.Action.Objects.Confirm.Title", - yesI18n: "Popup.Action.Objects.Confirm.Delete", - red: "yes", - yes: () => { - status.model.deleteBehavior(behavior); - status.setBehaviorObject(); - } - }) - } + this.handelDeleteBehavior(behavior) }} /> - - { - allParameterKeys.length > 0 ? - : null - } - { - allParameterKeys.map((key) => { - return this.renderParameter(behavior, key); - }) - } + behavior.getTerms(option.name, language)} + title={"Panel.Info.Behavior.Details.Behavior.Props"} + titleOption={{ + behavior: behavior.getTerms(behavior.behaviorName, this.props.setting?.language) + }} + change={(key, value) => { + this.props.status?.changeBehaviorAttrib( + behavior.id, key as string, value + ); + }} + /> ; } - private renderParameter - (behavior: Behavior>, key: keyof T): ReactNode { - const type = behavior.parameterOption[key]; - const value = behavior.parameter[key]; - const indexKey = `${behavior.id}-${key}`; - - if (type.type === "number") { - return { - this.props.status?.changeBehaviorAttrib(behavior.id, key as string, (val as any) / 1); - }} - /> - } - - if (type.type === "string") { - return { - this.props.status?.changeBehaviorAttrib(behavior.id, key as string, val); - }} - /> - } - - if (type.type === "boolean") { - return { - this.props.status?.changeBehaviorAttrib(behavior.id, key as string, val); - }} - /> - } - - if (isObjectType(type.type as any)) { - return { - (value as any).picker = obj; - this.props.status?.changeBehaviorAttrib(behavior.id, key as string, value); - }} - cleanValue={() => { - (value as any).picker = undefined; - this.props.status?.changeBehaviorAttrib(behavior.id, key as string, value); - }} - /> - } - - if (isVectorType(type.type as any)) { - return - - { - (value as number[])[0] = (val as any) / 1; - this.props.status?.changeBehaviorAttrib(behavior.id, key as string, value); - }} - /> - - { - (value as number[])[1] = (val as any) / 1; - this.props.status?.changeBehaviorAttrib(behavior.id, key as string, value); - }} - /> - - { - (value as number[])[2] = (val as any) / 1; - this.props.status?.changeBehaviorAttrib(behavior.id, key as string, value); - }} - /> - - - } - - return - } - public render(): ReactNode { if (this.props.status && this.props.status.focusBehavior) { return this.renderFrom(this.props.status.focusBehavior); diff --git a/source/Panel/BehaviorList/BehaviorList.tsx b/source/Panel/BehaviorList/BehaviorList.tsx index f07d8d4..11b7a09 100644 --- a/source/Panel/BehaviorList/BehaviorList.tsx +++ b/source/Panel/BehaviorList/BehaviorList.tsx @@ -1,11 +1,11 @@ -import { BehaviorList as BehaviorListComponent } from "@Component/BehaviorList/BehaviorList"; import { Component } from "react"; +import { BehaviorList as BehaviorListComponent } from "@Component/BehaviorList/BehaviorList"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { useSetting, IMixinSettingProps } from "@Context/Setting"; -import { Behavior } from "@Model/Behavior"; -import { Message } from "@Component/Message/Message"; import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; import { BehaviorPopup } from "@Component/BehaviorPopup/BehaviorPopup"; +import { Behavior } from "@Model/Behavior"; +import { Message } from "@Input/Message/Message"; import "./BehaviorList.scss"; interface IBehaviorListProps { diff --git a/source/Panel/GroupDetails/GroupDetails.tsx b/source/Panel/GroupDetails/GroupDetails.tsx index 26dd47f..35d3ed5 100644 --- a/source/Panel/GroupDetails/GroupDetails.tsx +++ b/source/Panel/GroupDetails/GroupDetails.tsx @@ -1,18 +1,18 @@ import { Component, ReactNode } from "react"; -import { AttrInput } from "@Component/AttrInput/AttrInput"; +import { AttrInput } from "@Input/AttrInput/AttrInput"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { useSetting, IMixinSettingProps } from "@Context/Setting"; -import { Message } from "@Component/Message/Message"; +import { ComboInput, IDisplayItem } from "@Input/ComboInput/ComboInput"; +import { Message } from "@Input/Message/Message"; import { ObjectID } from "@Model/Renderer"; -import { ColorInput } from "@Component/ColorInput/ColorInput"; -import { TogglesInput } from "@Component/TogglesInput/TogglesInput"; -import { LabelPicker } from "@Component/LabelPicker/LabelPicker"; +import { ColorInput } from "@Input/ColorInput/ColorInput"; +import { TogglesInput } from "@Input/TogglesInput/TogglesInput"; +import { LabelPicker } from "@Input/LabelPicker/LabelPicker"; import { Group, GenMod } from "@Model/Group"; import { AllI18nKeys } from "@Component/Localization/Localization"; -import { ComboInput, IDisplayItem } from "@Component/ComboInput/ComboInput"; -import { ObjectPicker } from "@Component/ObjectPicker/ObjectPicker"; +import { ObjectPicker } from "@Input/ObjectPicker/ObjectPicker"; import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; -import { BehaviorPicker } from "@Component/BehaviorPicker/BehaviorPicker"; +import { BehaviorPicker } from "@Input/BehaviorPicker/BehaviorPicker"; import "./GroupDetails.scss"; interface IGroupDetailsProps {} diff --git a/source/Panel/LabelDetails/LabelDetails.tsx b/source/Panel/LabelDetails/LabelDetails.tsx index 5b55fba..28d1698 100644 --- a/source/Panel/LabelDetails/LabelDetails.tsx +++ b/source/Panel/LabelDetails/LabelDetails.tsx @@ -1,11 +1,11 @@ import { Component, ReactNode } from "react"; -import { AttrInput } from "@Component/AttrInput/AttrInput"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; -import { Message } from "@Component/Message/Message"; -import { ColorInput } from "@Component/ColorInput/ColorInput"; -import { Label } from "@Model/Label"; -import { TogglesInput } from "@Component/TogglesInput/TogglesInput"; +import { TogglesInput } from "@Input/TogglesInput/TogglesInput"; import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; +import { ColorInput } from "@Input/ColorInput/ColorInput"; +import { AttrInput } from "@Input/AttrInput/AttrInput"; +import { Message } from "@Input/Message/Message"; +import { Label } from "@Model/Label"; import "./LabelDetails.scss"; @useStatusWithEvent("focusLabelChange", "labelAttrChange", "labelChange") diff --git a/source/Panel/LabelList/LabelList.tsx b/source/Panel/LabelList/LabelList.tsx index 51704a5..dbc1483 100644 --- a/source/Panel/LabelList/LabelList.tsx +++ b/source/Panel/LabelList/LabelList.tsx @@ -1,10 +1,10 @@ -import { LabelList as LabelListComponent } from "@Component/LabelList/LabelList"; import { Component } from "react"; +import { LabelList as LabelListComponent } from "@Component/LabelList/LabelList"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { useSetting, IMixinSettingProps } from "@Context/Setting"; -import { Label } from "@Model/Label"; -import { Message } from "@Component/Message/Message"; import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; +import { Message } from "@Input/Message/Message"; +import { Label } from "@Model/Label"; import "./LabelList.scss"; interface ILabelListProps { diff --git a/source/Panel/ObjectList/ObjectCommand.tsx b/source/Panel/ObjectList/ObjectCommand.tsx index e33ee70..97b856c 100644 --- a/source/Panel/ObjectList/ObjectCommand.tsx +++ b/source/Panel/ObjectList/ObjectCommand.tsx @@ -1,9 +1,9 @@ -import { BackgroundLevel, FontLevel, Theme } from "@Component/Theme/Theme"; -import { useStatus, IMixinStatusProps } from "../../Context/Status"; -import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; -import { Icon } from "@fluentui/react"; import { Component, ReactNode } from "react"; +import { BackgroundLevel, FontLevel, Theme } from "@Component/Theme/Theme"; +import { useStatus, IMixinStatusProps } from "@Context/Status"; +import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; import { ObjectID } from "@Model/Renderer"; +import { Icon } from "@fluentui/react"; import "./ObjectList.scss"; @useStatus diff --git a/source/Panel/ObjectList/ObjectList.tsx b/source/Panel/ObjectList/ObjectList.tsx index 6c24c8b..22a39aa 100644 --- a/source/Panel/ObjectList/ObjectList.tsx +++ b/source/Panel/ObjectList/ObjectList.tsx @@ -1,8 +1,8 @@ import { Component, ReactNode } from "react"; -import { DetailsList } from "@Component/DetailsList/DetailsList"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { useSetting, IMixinSettingProps } from "@Context/Setting"; import { Localization } from "@Component/Localization/Localization"; +import { DetailsList } from "@Component/DetailsList/DetailsList"; import { ObjectID } from "@Model/Renderer"; import { Icon } from "@fluentui/react"; import "./ObjectList.scss"; diff --git a/source/Panel/Panel.tsx b/source/Panel/Panel.tsx index 8c03517..c7ba6fc 100644 --- a/source/Panel/Panel.tsx +++ b/source/Panel/Panel.tsx @@ -1,15 +1,15 @@ import { ReactNode, Component, FunctionComponent } from "react"; import { Theme } from "@Component/Theme/Theme"; -import { Message } from "@Component/Message/Message"; -import { RenderView } from "./RenderView/RenderView"; -import { ObjectList } from "./ObjectList/ObjectList"; -import { ObjectCommand } from "./ObjectList/ObjectCommand"; -import { RangeDetails } from "./RangeDetails/RangeDetails"; -import { LabelList } from "./LabelList/LabelList"; -import { LabelDetails } from "./LabelDetails/LabelDetails"; -import { GroupDetails } from "./GroupDetails/GroupDetails"; -import { BehaviorList } from "./BehaviorList/BehaviorList"; -import { BehaviorDetails } from "./BehaviorDetails/BehaviorDetails"; +import { Message } from "@Input/Message/Message"; +import { RenderView } from "@Panel/RenderView/RenderView"; +import { ObjectList } from "@Panel/ObjectList/ObjectList"; +import { ObjectCommand } from "@Panel/ObjectList/ObjectCommand"; +import { RangeDetails } from "@Panel/RangeDetails/RangeDetails"; +import { LabelList } from "@Panel/LabelList/LabelList"; +import { LabelDetails } from "@Panel/LabelDetails/LabelDetails"; +import { GroupDetails } from "@Panel/GroupDetails/GroupDetails"; +import { BehaviorList } from "@Panel/BehaviorList/BehaviorList"; +import { BehaviorDetails } from "@Panel/BehaviorDetails/BehaviorDetails"; interface IPanelInfo { nameKey: string; diff --git a/source/Panel/RangeDetails/RangeDetails.tsx b/source/Panel/RangeDetails/RangeDetails.tsx index f5aeee9..81fe910 100644 --- a/source/Panel/RangeDetails/RangeDetails.tsx +++ b/source/Panel/RangeDetails/RangeDetails.tsx @@ -1,12 +1,12 @@ import { Component, ReactNode } from "react"; -import { AttrInput } from "@Component/AttrInput/AttrInput"; -import { useStatusWithEvent, IMixinStatusProps, Status } from "@Context/Status"; -import { Message } from "@Component/Message/Message"; +import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; +import { AttrInput } from "@Input/AttrInput/AttrInput"; +import { Message } from "@Input/Message/Message"; import { Range } from "@Model/Range"; import { ObjectID } from "@Model/Renderer"; -import { ColorInput } from "@Component/ColorInput/ColorInput"; -import { TogglesInput } from "@Component/TogglesInput/TogglesInput"; -import { LabelPicker } from "@Component/LabelPicker/LabelPicker"; +import { ColorInput } from "@Input/ColorInput/ColorInput"; +import { TogglesInput } from "@Input/TogglesInput/TogglesInput"; +import { LabelPicker } from "@Input/LabelPicker/LabelPicker"; import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; import "./RangeDetails.scss"; diff --git a/tsconfig.json b/tsconfig.json index e8bd41b..db2de5a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -32,6 +32,9 @@ "@Component/*": [ "./source/Component/*" ], + "@Input/*": [ + "./source/Input/*" + ], "@Localization/*": [ "./source/Localization/*" ],