修改预设,力场形状显示开关

This commit is contained in:
tianmo committed 2026-09-22 16:58:44 +08:00
1 parent 5f3a4a33fe
commit 4f2c980bac
9 files changed
+581 -18

No files matched your search

+3
View File
@@ -154,12 +154,14 @@ export function defaultConfig(): EmitterConfig {
forceCenterX: 0,
forceCenterY: 0,
forceFalloff: 'linear',
showForceFieldShape: true,
vortex: false,
vortexStrength: 10,
vortexRadius: 100,
vortexCenterX: 0,
vortexCenterY: 0,
vortexFalloff: 'linear',
showVortexShape: true,
attraction: false,
attractionCenterX: 200,
attractionCenterY: 0,
@@ -168,6 +170,7 @@ export function defaultConfig(): EmitterConfig {
attractionDelay: 0.1,
attractionDelayMode: 'particle',
attractionPath: 'curve',
showAttractionShape: true,
trail: false,
trailConfigVersion: 3,
trailResources: [{
+3
View File
@@ -291,6 +291,7 @@ export interface EmitterConfig {
forceCenterX: number
forceCenterY: number
forceFalloff: FieldFalloff
showForceFieldShape: boolean
/** 开启漩涡力;正强度逆时针,负强度顺时针。 */
vortex: boolean
vortexStrength: number
@@ -298,6 +299,7 @@ export interface EmitterConfig {
vortexCenterX: number
vortexCenterY: number
vortexFalloff: FieldFalloff
showVortexShape: boolean
/** 开启吸附:粒子在延迟后从当前位置移动到全局吸附点,到达范围后死亡 */
attraction: boolean
attractionCenterX: number
@@ -307,6 +309,7 @@ export interface EmitterConfig {
attractionDelay: number
attractionDelayMode: 'global' | 'particle'
attractionPath: 'linear' | 'curve'
showAttractionShape: boolean
/** 开启拖尾 */
trail: boolean
trailConfigVersion: number
@@ -80,6 +80,7 @@
</select>
</label>
<div class="modifier-hint">正数吸向中心 · 负数向外排斥 · 可在画布内拖动力场圆</div>
<label class="switch-row"><input type="checkbox" v-model="sys.config.showForceFieldShape" /><span class="switch-ui"></span><span>显示形状</span></label>
</div>
</div>
<div class="modifier-item">
@@ -100,6 +101,7 @@
</select>
</label>
<div class="modifier-hint">正数逆时针 · 负数顺时针</div>
<label class="switch-row"><input type="checkbox" v-model="sys.config.showVortexShape" /><span class="switch-ui"></span><span>显示形状</span></label>
</div>
</div>
<div class="modifier-item">
@@ -126,6 +128,7 @@
</select>
</label>
<div class="modifier-hint">延迟后从当前位置开始吸附 · 到达红色范围即死亡 · 可在画布内拖动吸附圆</div>
<label class="switch-row"><input type="checkbox" v-model="sys.config.showAttractionShape" /><span class="switch-ui"></span><span>显示形状</span></label>
</div>
</div>
<div class="modifier-item">
+3 -3
View File
@@ -325,10 +325,10 @@ const MODULE_RESET_KEYS: Record<Exclude<ResetModule, 'export'>, string[]> = {
'noise', 'noiseAmt', 'noiseRange', 'noiseSpeed',
'useGravity', 'gravity', 'gravityMode', 'gravityMin', 'gravityMax', 'gravityDirection', 'gravityCurve',
'wind', 'windX', 'windY', 'windMode', 'windMin', 'windMax', 'windDirection', 'windCurve',
'forceField', 'forceStrength', 'forceRadius', 'forceCenterX', 'forceCenterY', 'forceFalloff',
'vortex', 'vortexStrength', 'vortexRadius', 'vortexCenterX', 'vortexCenterY', 'vortexFalloff',
'forceField', 'forceStrength', 'forceRadius', 'forceCenterX', 'forceCenterY', 'forceFalloff', 'showForceFieldShape',
'vortex', 'vortexStrength', 'vortexRadius', 'vortexCenterX', 'vortexCenterY', 'vortexFalloff', 'showVortexShape',
'attraction', 'attractionCenterX', 'attractionCenterY', 'attractionRadius',
'attractionDuration', 'attractionDelay', 'attractionDelayMode', 'attractionPath',
'attractionDuration', 'attractionDelay', 'attractionDelayMode', 'attractionPath', 'showAttractionShape',
'trail', 'trailConfigVersion', 'trailResources', 'trailResourceVersion',
'trailTexture', 'trailTextureName', 'trailPreviewUrl', 'trailColorMode', 'trailColor',
'trailColorGradient', 'trailAlphaMode', 'trailAlpha', 'trailAlphaCurve',
+3 -3
View File
@@ -116,7 +116,7 @@ export function drawForceField(store: EditorStore, forceFieldGfx: Graphics | nul
const sys = store.systems.find((item) => item.id === store.activeId)
if (sys?.visible === false) return
const cfg = sys?.config
if (!cfg?.forceField || cfg.forceRadius <= 0) return
if (!cfg?.forceField || !cfg.showForceFieldShape || cfg.forceRadius <= 0) return
const x = cfg.forceCenterX
const y = -cfg.forceCenterY
const color = cfg.forceStrength >= 0 ? 0x58c7ff : 0xff6b7a
@@ -140,7 +140,7 @@ export function drawVortex(store: EditorStore, vortexGfx: Graphics | null) {
const sys = store.systems.find((item) => item.id === store.activeId)
if (sys?.visible === false) return
const cfg = sys?.config
if (!cfg?.vortex || cfg.vortexRadius <= 0) return
if (!cfg?.vortex || !cfg.showVortexShape || cfg.vortexRadius <= 0) return
const x = cfg.vortexCenterX
const y = -cfg.vortexCenterY
const color = cfg.vortexStrength >= 0 ? 0xb97cff : 0xffa24c
@@ -168,7 +168,7 @@ export function drawAttraction(store: EditorStore, attractionGfx: Graphics | nul
const sys = store.systems.find((item) => item.id === store.activeId)
if (sys?.visible === false) return
const cfg = sys?.config
if (!cfg?.attraction) return
if (!cfg?.attraction || !cfg.showAttractionShape) return
const x = cfg.attractionCenterX
const y = -cfg.attractionCenterY
const radius = Math.max(0, cfg.attractionRadius)