Skip to content

Commit

Permalink
fix: resolve material conversion error
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyaoji committed Sep 7, 2021
1 parent a7e41dc commit 0c766c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/utils/cesium-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,14 @@ export function makeMaterial (val: string | Array<number> | MaterialOption) {
f(val)
return new Material(val as MaterialOption)
}
return val

if (isArray(val) || isString(val)) {
const material = Material.fromType('Color')
material.uniforms.color = makeColor(val)
return material
}

return undefined
}

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ export function dirname (path: string): string {
return path.slice(0, end)
}

export function removeEmpty (obj: unknown): AnyObject {
export function removeEmpty (obj: any): AnyObject {
const proto = Object.getPrototypeOf(obj)
const finalObj: AnyObject = {}
Object.setPrototypeOf(finalObj, proto)
Object.keys(obj).forEach(key => {
const className = getObjClassName(obj[key])
if ((obj[key] && isArray(obj[key]) || obj[key] instanceof Element)) {
Expand Down

0 comments on commit 0c766c0

Please sign in to comment.