* Center this object in its parent * 在父容器中居中
(bRestraint: boolean = false)
| 208 | * 在父容器中居中 |
| 209 | */ |
| 210 | public center(bRestraint: boolean = false): void { |
| 211 | const r = this._parent || this.root; |
| 212 | if (r) { |
| 213 | this.setXY((r.width - this.width) / 2, (r.height - this.height) / 2); |
| 214 | if (bRestraint) { |
| 215 | this.addRelation(r, ERelationType.CenterCenter); |
| 216 | this.addRelation(r, ERelationType.MiddleMiddle); |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | // Size | 尺寸 |
| 222 |
nothing calls this directly
no test coverage detected