https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • a

    ambitious-knife-25690

    02/27/2023, 5:23 PM
    yeah, that's what is confusing me tbh
  • b

    bright-gpu-74537

    02/27/2023, 5:23 PM
    why?
  • a

    ambitious-knife-25690

    02/27/2023, 5:24 PM
    because it seems like supplying w/h props to the image component is redundant
  • b

    bright-gpu-74537

    02/27/2023, 5:24 PM
    it is
  • a

    ambitious-knife-25690

    02/27/2023, 5:24 PM
    lol
  • b

    bright-gpu-74537

    02/27/2023, 5:24 PM
    unless you want to resize it from its original size
  • a

    ambitious-knife-25690

    02/27/2023, 5:24 PM
    but even if you do want to resize it, it seems like none of the backend code i've seen so far takes those values into account
  • b

    bright-gpu-74537

    02/27/2023, 5:25 PM
    takes what value? The width and the height you supply? (assuming you did supply it)
  • a

    ambitious-knife-25690

    02/27/2023, 5:25 PM
    yeah
  • b

    bright-gpu-74537

    02/27/2023, 5:26 PM
    well, that link above (heaps) takes _imageWidth and _imageHeight into account (
    var scaleX:Float = (_imageWidth / sprite.tile.width) * Toolkit.scaleX;
    )
  • b

    bright-gpu-74537

    02/27/2023, 5:26 PM
    and i assure you, so do the others 🙂
  • a

    ambitious-knife-25690

    02/27/2023, 5:26 PM
    yeah, that's the actual image dimensions though
  • b

    bright-gpu-74537

    02/27/2023, 5:27 PM
    not always
  • a

    ambitious-knife-25690

    02/27/2023, 5:27 PM
    not the supplied dimensions
  • a

    ambitious-knife-25690

    02/27/2023, 5:27 PM
    oh?
  • b

    bright-gpu-74537

    02/27/2023, 5:27 PM
    if you do
    <Image resource="ceramic" width="260" height="340" />
    then _imageWidth and _imageHeight will be those values
  • b

    bright-gpu-74537

    02/27/2023, 5:28 PM
    or if you did
    <Image resource="ceramic" width="100%" height="100%" />
    then this values will be whatever it calculates "100%" as
  • a

    ambitious-knife-25690

    02/27/2023, 5:28 PM
    Copy code
    xml
    <box width="100%" height="100%" style="background-color: #FFCCFF;background-opacity:.3;clip:true;">
        <vbox>
            <hbox width="33%">
                <Image resource="https://cdn.discordapp.com/emojis/567736760243847169.webp?size=96&quality=lossless" width="130" height="170" />
            </hbox>
            <hbox width="33%">
                <Image resource="file://C:/Users/Jazz/Pictures/brainbig.png" width="130" height="170" />
            </hbox>
            <hbox width="33%">
                <Image resource="ceramic" width="130" height="170" />
            </hbox>
        </vbox>
    </box>
  • a

    ambitious-knife-25690

    02/27/2023, 5:29 PM
    imagew/h is returning native image dimensions everytime here
  • b

    bright-gpu-74537

    02/27/2023, 5:29 PM
    then something else is up
  • b

    bright-gpu-74537

    02/27/2023, 5:30 PM
    http://haxeui.org/builder/?499b1d38
  • a

    ambitious-knife-25690

    02/27/2023, 5:31 PM
    huh, i wonder what's going on here then 🤔
  • b

    bright-gpu-74537

    02/27/2023, 5:31 PM
    when are you using _imageWidth / _imageHeight?
  • b

    bright-gpu-74537

    02/27/2023, 5:31 PM
    can i see your ImageDisplayImpl.hx?
  • a

    ambitious-knife-25690

    02/27/2023, 5:31 PM
    Copy code
    hx
        private override function validateData():Void {
            if (_imageInfo != null) {
                this.visual.texture = _imageInfo.data;
                
                this.visual.width = Std.int(_imageInfo.width);
                this.visual.height = Std.int(_imageInfo.height);
            }
        }
  • a

    ambitious-knife-25690

    02/27/2023, 5:31 PM
    Copy code
    hx
    package haxe.ui.backend;
    
    import ceramic.Color;
    import ceramic.Quad;
    
    class ImageDisplayImpl extends ImageBase {
        public var visual:Quad;
    
        public function new() {
            super();
            this.visual = new Quad();
            //this.visual.color = Color.NONE;
        }
    
        private override function validateData():Void {
            if (_imageInfo != null) {
                this.visual.texture = _imageInfo.data;
                
                this.visual.width = Std.int(_imageInfo.width);
                this.visual.height = Std.int(_imageInfo.height);
            }
        }
    
        private override function validatePosition() {
            if (visual.x != _left) {
                    visual.x = _left;
            }
    
            if (visual.y != _top) {
                    visual.y = _top;
            }
        }
    
        override function dispose() {
            super.dispose();
            this.visual.dispose();
        }
    }
  • a

    ambitious-knife-25690

    02/27/2023, 5:31 PM
    its pretty bare
  • b

    bright-gpu-74537

    02/27/2023, 5:32 PM
    ... validateDisplay
  • b

    bright-gpu-74537

    02/27/2023, 5:32 PM
    i would have half expected validateData to work also... but by accident... i cant actually remember the validation sequence
  • b

    bright-gpu-74537

    02/27/2023, 5:33 PM
    presumably its: data -> display -> positon
1...154515461547...1687Latest