MCPcopy Create free account
hub / github.com/Barrior/JParticles / updateComplexOptions

Method updateComplexOptions

src/wave.ts:299–328  ·  view source on GitHub ↗

* 更新复杂选项值(合并赋值) * @param property 选项属性 * @param newValue 新值

(
    property: ComplexOptions,
    newValue?: ValueOf<Pick<Options, ComplexOptions>>
  )

Source from the content-addressed store, hash-verified

297 * @param newValue 新值
298 */
299 protected updateComplexOptions(
300 property: ComplexOptions,
301 newValue?: ValueOf<Pick<Options, ComplexOptions>>
302 ): void {
303 if (!newValue) return
304
305 const scaleRange =
306 property === 'offsetLeft' ? this.canvasWidth : this.canvasHeight
307 const options = this.options as StdOptions & CommonConfig
308 const isArrayType = Array.isArray(newValue)
309
310 options[property].forEach(
311 (curValue: StrNumBool, i: number, array: StrNumBool[]) => {
312 let value = isArrayType ? (newValue as StrNumBool[])[i] : newValue
313
314 value = Wave.getOptionProcessedValue(
315 property,
316 value as StrNumBool,
317 scaleRange
318 )
319
320 // 未定义部分保持原有值
321 if (isUndefined(value)) {
322 value = curValue
323 }
324
325 array[i] = value
326 }
327 )
328 }
329
330 /**
331 * 更新简单选项值(直接赋值)

Callers 1

setOptionsMethod · 0.95

Calls 2

isUndefinedFunction · 0.90

Tested by

no test coverage detected