ADD: the api call to create a new Entity
This commit is contained in:
@@ -48,22 +48,47 @@ state = {
|
||||
{
|
||||
if(SelectedEntity !== undefined)
|
||||
{
|
||||
let tmp = [];
|
||||
var tmp = {};
|
||||
// tmp.NewPos= new Array(0,0);
|
||||
// console.log(tmp);
|
||||
|
||||
Entities.map((val) => {
|
||||
if(val.id === SelectedEntity.Name)
|
||||
{
|
||||
tmp = val
|
||||
if(SelectedEntity.NewPos !== undefined)
|
||||
{
|
||||
tmp.OldPos = val.Position;
|
||||
tmp.Position[0] = round(SelectedEntity.NewPos[0],3);
|
||||
tmp.Position[1] = round(SelectedEntity.NewPos[1],3);
|
||||
tmp = val
|
||||
// tmp = JSON.parse(JSON.stringify(val));
|
||||
// console.log(tmp);
|
||||
|
||||
|
||||
// console.log(SelectedEntity);
|
||||
|
||||
if(SelectedEntity.NewPos !== undefined)
|
||||
{
|
||||
// Object.assign(tmp, {NewPos: [{},{}]});
|
||||
Object.assign(val, {NewPos: [{},{}]});
|
||||
|
||||
// tmp.OldPos = val.Position;
|
||||
// Object.assign(tmp, {NewPos: [round(SelectedEntity.NewPos[0],3),0]});
|
||||
// val.NewPos = SelectedEntity.NewPos;
|
||||
val.NewPos[0] = round(SelectedEntity.NewPos[0],3);
|
||||
val.NewPos[1] = round(SelectedEntity.NewPos[1],3);
|
||||
|
||||
// tmp.NewPos[0] = round(SelectedEntity.NewPos[0],3);
|
||||
// tmp.NewPos[1] = round(SelectedEntity.NewPos[1],3);
|
||||
|
||||
}else{
|
||||
|
||||
// Object.assign(tmp, {NewPos: val.Position});
|
||||
|
||||
// tmp.NewPosition[1] = val.Position[1];
|
||||
|
||||
|
||||
}
|
||||
tmp.NewPos = SelectedEntity.NewPos;
|
||||
// tmp.NewPos = SelectedEntity.NewPos;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
})
|
||||
// console.log(tmp);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +101,7 @@ state = {
|
||||
<br />
|
||||
<div>
|
||||
<button onClick={this.props.updateEntities}>update</button>
|
||||
<EntityControl Entity = { getEntityFromID(this.props.Entities,this.props.EntityOnFocus)}/>
|
||||
<EntityControl Client = { this.props.Client } Entity = { getEntityFromID(this.props.Entities,this.props.EntityOnFocus)} PositionCliecked = {this.props.PositionClicked}/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user