So there is a bug with the Image._renderNinePatch when:
There is an ADT idealWidth/Height and you use Image.width/Height percentages:
First playground shows WITHOUT ADT idealWidth/Height and borders look great, properly stretched:
Second playground shows WITH ADT idealWidth/Height and BORDERS ARE CROPPED OUT:
So I had devin.ai track down and fix the issue. And it fixed it perfectly.
We need a fix for nine-patch rendering for BABYLON.GUI.Image when width/height are percentages and ADT has idealWidth/idealHeight.
The current code uses ValueAndUnit.getValue(this.host) (raw %) for idealRatio; the fix is to use resolved pixels from _currentMeasure.
Root cause
_renderNinePatch used this._width.getValue(this.host)/idealWidth (and height variant). For percentage sizes, getValue(host) is normalized, not pixels, collapsing slice scaling when ideal* is set.
I think the calculation for idealRatio is not quite right, it should be more like the ADT.idealRatio or better yet , just use the this.host.idealRatio instead of recalculating that when the adt already has it calculated correctly:
Doing some debugging I see that from within image class if i set idealWidth then this.host.idealRatio matches the calc in image because image.currentMeasure.width === adt.getSize().width (1713)
However if i set idealHeight instead, I’m seeing different results , where the idealRatios dont match because image._currentMeasure.height != adt.getSize().height
Honestly I’m not 100% sure whether we should be using the currentMeasure height or the ADT height – but they do produce slightly different visual results
currentMeasure