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

    bright-gpu-74537

    01/26/2023, 8:19 PM
    ah, i bet i know what it is:
  • b

    bright-gpu-74537

    01/26/2023, 8:19 PM
    http://haxeui.org/builder/?9f2d6e97
  • b

    bright-gpu-74537

    01/26/2023, 8:19 PM
    what does this look like on yours?
  • b

    bright-gpu-74537

    01/26/2023, 8:21 PM
    oh
  • b

    bright-gpu-74537

    01/26/2023, 8:21 PM
    then text text align isnt working for you (i assumed the red label wouldnt be full width)
  • a

    ambitious-knife-25690

    01/26/2023, 8:21 PM
    I guess, this implies that ceramics text align isn't working or i don't know how it works
  • b

    bright-gpu-74537

    01/26/2023, 8:22 PM
    presumably the latter? 🙂 If it has text align, i guess it'd work... paging Dr Jeremy 😄
  • b

    bright-gpu-74537

    01/26/2023, 8:22 PM
    actually, hang on
  • a

    ambitious-knife-25690

    01/26/2023, 8:22 PM
    Copy code
    hx
                if (_textStyle.textAlign != null) {
                    surface.align = switch (_textStyle.textAlign) {
                        case 'left': LEFT;
                        case 'center': CENTER;
                        case 'right': RIGHT;
                        default: LEFT;
                    }
                    measureTextRequired = true;
                }
  • a

    ambitious-knife-25690

    01/26/2023, 8:23 PM
    is my current text align setup
  • b

    bright-gpu-74537

    01/26/2023, 8:23 PM
    that just mans the label is full width... not the text display itself
  • a

    ambitious-knife-25690

    01/26/2023, 8:23 PM
    debug shows that it is picking center
  • b

    bright-gpu-74537

    01/26/2023, 8:23 PM
    can you give the textdisplay a background colour easy enough in ceramic?
  • b

    bright-gpu-74537

    01/26/2023, 8:23 PM
    i bet that isnt full width
  • b

    bright-gpu-74537

    01/26/2023, 8:24 PM
    long story short, i betcha this isnt implemented in your backend: https://github.com/haxeui/haxeui-openfl/blob/master/haxe/ui/backend/TextDisplayImpl.hx#L149-L162
  • a

    ambitious-knife-25690

    01/26/2023, 8:25 PM
    hmm, that isn't
  • a

    ambitious-knife-25690

    01/26/2023, 8:25 PM
    but mostly because ceramic handles text measurement itself so the width/height props of the surface were implied
  • b

    bright-gpu-74537

    01/26/2023, 8:25 PM
    yeah, so your ceramic textfield (whatever its called) is just autosized (presumably the default), so center isnt going to do anything
  • a

    ambitious-knife-25690

    01/26/2023, 8:26 PM
    but i'll try it
  • b

    bright-gpu-74537

    01/26/2023, 8:26 PM
    well, for text centering to work (regardless of ceramic) the ceramic textfield has to have a width (bigger than the size of the text - otherwise there is nothing to center)
  • b

    bright-gpu-74537

    01/26/2023, 8:27 PM
    same goes for word wrapping etc
  • a

    ambitious-knife-25690

    01/26/2023, 8:27 PM
    yeah, this is awkward
  • b

    bright-gpu-74537

    01/26/2023, 8:27 PM
    why?
  • a

    ambitious-knife-25690

    01/26/2023, 8:27 PM
    a ceramic's Text component's width is set to the width of its characters
  • b

    bright-gpu-74537

    01/26/2023, 8:27 PM
    sure, but cant you give it a width also?
  • a

    ambitious-knife-25690

    01/26/2023, 8:27 PM
    i can, but it wouldn't mean anything to ceramic itself
  • b

    bright-gpu-74537

    01/26/2023, 8:28 PM
    why wouldnt it?
  • a

    ambitious-knife-25690

    01/26/2023, 8:28 PM
    because it would just overwrite it when measuretext is called
  • a

    ambitious-knife-25690

    01/26/2023, 8:28 PM
    Copy code
    private override function validateDisplay() {
            if (surface.width != _width) {
                        surface.width = _width;
            }
    
            if (surface.height != _height) {
                        surface.height = _height;
            }
        }
  • b

    bright-gpu-74537

    01/26/2023, 8:28 PM
    ah, that "calcContent" call?
1...142214231424...1687Latest