|
@@ -133,8 +133,6 @@ export default class UIControl {
|
|
|
else{
|
|
|
floorplanService.updateTitle(value);
|
|
|
}
|
|
|
-
|
|
|
- text
|
|
|
}
|
|
|
else if(type == VectorType.BgImage){
|
|
|
await floorplanService.updateBgImage(value);
|
|
@@ -142,93 +140,136 @@ export default class UIControl {
|
|
|
else if(type == VectorType.Compass){
|
|
|
floorplanService.updateCompass(value);
|
|
|
}
|
|
|
+ else if(type == VectorType.CustomImage){
|
|
|
+ const customImage = floorplanService.getCustomImage(item.vectorId)
|
|
|
+ if(value.hasOwnProperty('rotate')){
|
|
|
+ customImage.setAngle(value.rotate)
|
|
|
+ }
|
|
|
+ else if(value.hasOwnProperty('scale')){
|
|
|
+ customImage.setScale(value.scale)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(signService.isSign(type)){
|
|
|
+ const sign = floorplanService.getSign(item.vectorId)
|
|
|
+ if(value.hasOwnProperty('rotate')){
|
|
|
+ sign.setAngle(value.rotate)
|
|
|
+ }
|
|
|
+ else if(value.hasOwnProperty('scale')){
|
|
|
+ sign.setScale(value.scale)
|
|
|
+ }
|
|
|
+ }
|
|
|
break;
|
|
|
case "upload":
|
|
|
if(type == VectorType.CustomImage){
|
|
|
customImageService.setCustomImageUrl(value.url);
|
|
|
- customImageService.createCustomImage({
|
|
|
+ const customImage = await customImageService.createCustomImage({
|
|
|
x:0,
|
|
|
y:0
|
|
|
})
|
|
|
stateService.setEventName(LayerEvents.MoveCustomImage);
|
|
|
+ let focusItem = {
|
|
|
+ vectorId: customImage.vectorId,
|
|
|
+ type: VectorType.CustomImage,
|
|
|
+ };
|
|
|
+ stateService.setFocusItem(focusItem);
|
|
|
+ this.showAttributes(focusItem);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
history.save();
|
|
|
- stateService.clearFocusItem();
|
|
|
- // this.bus.emit('hideAttribute')
|
|
|
- // this.bus.emit('hideUI')
|
|
|
+ //stateService.clearFocusItem();
|
|
|
this.layer.renderer.autoRedraw();
|
|
|
}
|
|
|
|
|
|
showAttributes(item) {
|
|
|
let type = item.type;
|
|
|
let value = null;
|
|
|
- switch (item.type) {
|
|
|
- case VectorType.Tag:
|
|
|
- const tag = floorplanService.getTag(item.vectorId);
|
|
|
- if (!tag) {
|
|
|
- return;
|
|
|
- }
|
|
|
- value = {
|
|
|
- version:'2.0',
|
|
|
- text:tag.value,
|
|
|
- color: tag.color,
|
|
|
- fontSize: tag.fontSize,
|
|
|
- };
|
|
|
- break;
|
|
|
- case VectorType.Table:
|
|
|
- const table = floorplanService.getTable(item.vectorId);
|
|
|
- if (!table) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const cellIds = table.cells;
|
|
|
- let content = [];
|
|
|
- for (let i = 0; i < cellIds.length; ++i) {
|
|
|
- for (let j = 0; j < cellIds[i].length; ++j) {
|
|
|
- const cell = floorplanService.getCell(cellIds[i][j]);
|
|
|
- content.push({
|
|
|
- width: cell.width,
|
|
|
- height: cell.height,
|
|
|
- value: cell.value,
|
|
|
- colIndex: cell.colIndex,
|
|
|
- rowIndex: cell.rowIndex,
|
|
|
- });
|
|
|
+
|
|
|
+ if(signService.isSign(type)){
|
|
|
+ const sign = floorplanService.getSign(item.vectorId);
|
|
|
+ if (!sign) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ value = {
|
|
|
+ version:'2.0',
|
|
|
+ type: type,
|
|
|
+ rotate:sign.angle,
|
|
|
+ scale:sign.scale
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ switch (item.type) {
|
|
|
+ case VectorType.Tag:
|
|
|
+ const tag = floorplanService.getTag(item.vectorId);
|
|
|
+ if (!tag) {
|
|
|
+ return;
|
|
|
}
|
|
|
- }
|
|
|
- value = {
|
|
|
- version:'2.0',
|
|
|
- content: content,
|
|
|
- };
|
|
|
- break;
|
|
|
- case VectorType.Title:
|
|
|
- const title = floorplanService.getTitle();
|
|
|
- if (!title) {
|
|
|
- return;
|
|
|
- }
|
|
|
- value = {
|
|
|
- version:'2.0',
|
|
|
- text: title.value,
|
|
|
- };
|
|
|
- break;
|
|
|
- case VectorType.Compass:
|
|
|
- const compass = floorplanService.getCompass();
|
|
|
- if (!compass) {
|
|
|
- return;
|
|
|
- }
|
|
|
- value = compass.angle;
|
|
|
- break;
|
|
|
- // case VectorType.CustomImage:
|
|
|
- // const customImage = floorplanService.getCustomImage(item.vectorId);
|
|
|
- // if (!customImage) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // value = {
|
|
|
- // version:'2.0',
|
|
|
- // url: customImage.url,
|
|
|
- // };
|
|
|
- // break;
|
|
|
+ value = {
|
|
|
+ version:'2.0',
|
|
|
+ type: type,
|
|
|
+ text:tag.value,
|
|
|
+ color: tag.color,
|
|
|
+ fontSize: tag.fontSize,
|
|
|
+ };
|
|
|
+ break;
|
|
|
+ case VectorType.Table:
|
|
|
+ const table = floorplanService.getTable(item.vectorId);
|
|
|
+ if (!table) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const cellIds = table.cells;
|
|
|
+ let content = [];
|
|
|
+ for (let i = 0; i < cellIds.length; ++i) {
|
|
|
+ for (let j = 0; j < cellIds[i].length; ++j) {
|
|
|
+ const cell = floorplanService.getCell(cellIds[i][j]);
|
|
|
+ content.push({
|
|
|
+ width: cell.width,
|
|
|
+ height: cell.height,
|
|
|
+ value: cell.value,
|
|
|
+ colIndex: cell.colIndex,
|
|
|
+ rowIndex: cell.rowIndex,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ value = {
|
|
|
+ version:'2.0',
|
|
|
+ type: type,
|
|
|
+ content: content,
|
|
|
+ };
|
|
|
+ break;
|
|
|
+ case VectorType.Title:
|
|
|
+ const title = floorplanService.getTitle();
|
|
|
+ if (!title) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ value = {
|
|
|
+ version:'2.0',
|
|
|
+ type: type,
|
|
|
+ text: title.value,
|
|
|
+ };
|
|
|
+ break;
|
|
|
+ case VectorType.Compass:
|
|
|
+ const compass = floorplanService.getCompass();
|
|
|
+ if (!compass) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ value = compass.angle;
|
|
|
+ break;
|
|
|
+ case VectorType.CustomImage:
|
|
|
+ const customImage = floorplanService.getCustomImage(item.vectorId);
|
|
|
+ if (!customImage) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ value = {
|
|
|
+ version:'2.0',
|
|
|
+ type: type,
|
|
|
+ url: customImage.url,
|
|
|
+ rotate:customImage.angle,
|
|
|
+ scale:customImage.scale
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
this.bus.emit("showAttribute", {
|
|
|
type: type,
|
|
|
value: value,
|