|
|
|
@ -257,6 +257,57 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.backgroundImage.addChild(enterPaintEndButton); |
|
|
|
|
enterPaintEndButton.zIndex = this.backgroundImage.children.length; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 将json的key值进行大小写转换 |
|
|
|
|
* @param json json对象 |
|
|
|
|
* @param type 默认不传 ==>全部小写;传1 ==>全部大写;传2 ==>首字母大写 |
|
|
|
|
*/ |
|
|
|
|
jsonKeysToCase(json, type) { |
|
|
|
|
if (typeof json === 'object') { |
|
|
|
|
const tempJson = JSON.parse(JSON.stringify(json)); |
|
|
|
|
toCase(tempJson); |
|
|
|
|
return tempJson; |
|
|
|
|
} else { |
|
|
|
|
return json; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// tslint:disable-next-line: no-shadowed-variable
|
|
|
|
|
function toCase(json) { |
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (typeof json == 'object') { |
|
|
|
|
if (Array.isArray(json)) { |
|
|
|
|
// tslint:disable-next-line: only-arrow-functions
|
|
|
|
|
json.forEach(function(item) { |
|
|
|
|
toCase(item); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// tslint:disable-next-line: forin
|
|
|
|
|
for (const key in json) { |
|
|
|
|
const item = json[key]; |
|
|
|
|
// tslint:disable-next-line: triple-equals
|
|
|
|
|
if (typeof item == 'object') { |
|
|
|
|
toCase(item); |
|
|
|
|
} |
|
|
|
|
delete (json[key]); |
|
|
|
|
switch (type) { |
|
|
|
|
case 1: |
|
|
|
|
// key值全部大写
|
|
|
|
|
json[key.toLocaleUpperCase()] = item; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
// key值首字母大写,其余小写
|
|
|
|
|
json[key.substring(0, 1).toLocaleUpperCase() + key.substring(1).toLocaleLowerCase()] = item; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
// 默认key值全部小写
|
|
|
|
|
json[key.toLocaleLowerCase()] = item; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 创建背景图 |
|
|
|
|
*/ |
|
|
|
@ -306,7 +357,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
MultiPoint : null, |
|
|
|
|
Point: new PIXI.Point(this.previewSinglePointIcon.x, this.previewSinglePointIcon.y), |
|
|
|
|
Name : this.canvasData.selectTemplateData.name, |
|
|
|
|
PropertyInfos: JSON.parse(JSON.stringify(this.canvasData.selectTemplateData.propertyInfos)), |
|
|
|
|
PropertyInfos: this.jsonKeysToCase(this.canvasData.selectTemplateData.propertyInfos, 2), |
|
|
|
|
Border : this.canvasData.selectTemplateData.border, |
|
|
|
|
DrawMode : this.canvasData.selectTemplateData.drawMode, |
|
|
|
|
Thickness : this.canvasData.selectTemplateData.thickness, |
|
|
|
|