中心内容和叠加图形-地图-SVG

时间:2019-06-21 18:13:17

标签: html positioning

我无法对地图和图形进行居中定位并覆盖这两层。我对position:relative和position:absolute有点困惑。

selectedModel: Controllermodel[] = [];
roleId: number;
constructor() {
    this.router.params.subscribe(data => {
      this.roleId = +this.router.snapshot.paramMap.get('id');

    })

 onChangeValue(event, controllerId: string, actionId: number) {
    var test = this.selectedModel.find(x => x.controllerId === controllerId);

    if (test) {
      var findActionId = test.actionsVM.find(x => x.actionId === actionId);
      const Index = test.actionsVM.indexOf(findActionId);

      if (Index != -1) {
        test.actionsVM.splice(Index, 1);
      } else {
        test.actionsVM.push({ actionEnglishName: null, actionId: actionId, displayName: null });
      }
    } else {
      this.selectedModel.push({
        controllerId: controllerId,
        roleId: this.roleId,
        controllerDisplayName: null,
        controllerFarsiName: null,
        actionsVM: [{
          actionEnglishName: null,
          actionId: actionId,
          displayName: null
        }]
      });
    }
    console.log(this.selectedModel)
  }

这是一个小提琴:

https://jsfiddle.net/z3qf8u2e/

1 个答案:

答案 0 :(得分:0)

只需使用margin : 0 auto代替https://jsfiddle.net/1zhdrvje/