rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.21k stars 260 forks source link

rex的minicontainer 怎么和现在对象层次排序呢 #271

Closed woshisheji closed 2 years ago

woshisheji commented 2 years ago

大佬 我发现gird table 添加后 为什么会一直在最顶层呢,设置深度排序也无效 有点难受

如图:

image

然后我打开table image

使用了你说的那个child 设置层次似乎无效 3.55的版本

woshisheji commented 2 years ago

按道理它在 mini容器中,不应该在下一层吗,为啥一直在最顶了,看他的深度也是0~奇怪了。。

rexrainbow commented 2 years ago

Could you post a simplest test code for this case?

woshisheji commented 2 years ago

let 高级表格= {}; let 背景图= {}; let 滑块条= {}; let 滑块条前= {};

背景图 = H5object.add.rectangle(0,0,100,100, 0x272822);

滑块条 = H5object.add.rectangle(0, 0, 20, 4, 0x404040);

滑块条前 = H5object.add.rectangle(0, 0, 20, 40, 0x383830);

  高级表格 = H5object.rexUI.add.gridTable({x: 100, y: 100, anchor:0, width: 640, height: 200, scrollMode: 0, background: 背景图, table:{width:undefined, height:undefined, cellWidth: 100, cellHeight: 100, columns: 6, mask:{padding:-1}, interactive:true, reuseCellContainer:false, }, slider:{track: 滑块条, thumb: 滑块条前, }, scroller:{threshold:10, slidingDeceleration:2000, backDeceleration:5000, }, clamplChildOY:false, space:{left:0, right:0, top:0, bottom:0, table:0, table:{top:0, bottom:0, left:0, right:0, }, header:0, footer:0, }, expand:{header:true, footer:true, }, align:{header:'center', footer:'center', }, items:[], name:'', draggable:false, createCellContainerCallback:function(cell, cellContainer){

      if(cellContainer == undefined){
      cellContainer = H5object.rexUI.add.overlapSizer({x:0, y: 0, width: 100, height: 100,anchor: 0, space:{left: 0, right: 0, top: 0, bottom: 0}})

      let 临时背景 = H5object.add.rectangle(0, 0, 100, 100, 0x6C6C5E);

      临时背景.setStrokeStyle( 1,  0x007ACB,  1);

      cellContainer.add( 临时背景, {key: undefined, align: 'left', padding:{left: 0, right: 0, top: 0, bottom: 0}, expand: true, minWidth: undefined, minHeight: undefined})

      cellContainer.depth= 篮球盒子.depth + 1;

  }
  return(cellContainer);

}});

高级表格.setOrigin( 0, 0); 高级表格.layout();

let 篮球盒子 = H5object.add.container(100, 100); let 框子 = H5object.add.rectangle(0, 0, 100, 100, 0x404040);

框子.setOrigin( 0, 0); 篮球盒子.add(框子);

  H5object.input.keyboard.on('keydown-A', function (event) {

  let 临时对象 = {}
  临时对象.key = '001';
  Phaser.Utils.Array.Add(高级表格.items,  临时对象);
  高级表格.refresh();

}, H5object);

woshisheji commented 2 years ago

被覆盖掉了

woshisheji commented 2 years ago

不知道该如何 让这个表格与官方的容器之间进行排序

woshisheji commented 2 years ago

H5object.children.bringToTop(篮球盒子) 哦,似乎必须在表格事件中添加这个命令才可以。。。似乎有些复杂。不能直接整个表格管理吗

woshisheji commented 2 years ago

额。反复尝试下可以了。感谢大佬。