5

我有以下网格=>

  dashboard: Array<GridsterItemCustom> = [
    {cols: 4, rows: 10, y: 0, x: 1, type: NavigationMiniMapComponent, inputs: { synchGroupId : this.synchGroupId}, name: 'MINIMAP_NAME', id: 'waypoint'},
    {cols: 4, rows: 10, y: 0, x: 5, type: NavigationVrMapComponent, inputs: { synchGroupId : this.synchGroupId}, name: 'VRMAP_NAME', id: 'vrMap'},
    {cols: 1, rows: 3, y: 7, x: 0, type: NavigationWaypointUiComponent, name: 'WAYPOINT_INFO_NAME', id: 'informationn'},
    {cols: 1, rows: 3, y: 1, x: 0, type: NavigationDroneUiComponent, name: 'DRONE_INFO_NAME', id: 'droneNav'},
    {cols: 1, rows: 3, y: 4, x: 0, type: NavigationMissionUiComponent, name: 'ROUTE_INFO_NAME', id: 'routes'},
    {cols: 1, rows: 1, y: 0, x: 0, dragEnabled: false, resizeEnabled: false, type: NavigationMenuComponent, name: '', id: 'planMenu'},
  ];

当用户单击一个按钮时,我想添加一个新元素(并调整每个其他元素的大小,以便显示我的元素:

 onclick(value)
  if (value) {
    this.dashboard.push({cols: 4, rows: 5, y: 0, x: 1, type: NavigationRealMapComponent, name: 'REALMAP_NAME', id: 'videocam'});
  }
  if (!value) {
    const index = this.dashboard.findIndex(e => e.id === 'videocam');
    if (index > -1) {
      this.dashboard.splice(index, 1);
    }
  }
}

基本上,当前占用我想要放置新元素的空间的所有元素都将被调整大小。

有没有办法从包中做到这一点?或者我必须做一个自定义功能?

现在代码把这个扔给我

angular-gridster2.js:1649 无法放置在仪表板的边界内,试图自动定位!/n{"cols":4,"rows":5,"x":1,"y":0 } angular-gridster2.js:1804 不能放在仪表板的边界内!/n{"cols":4,"rows":5,"x":1,"y":0}

4

0 回答 0