axmol icon indicating copy to clipboard operation
axmol copied to clipboard

macOS Edit wrong alignment

Open Sevael opened this issue 1 year ago • 0 comments

macOS : core/ui/UIEditBox/Mac/UIEditBoxMac.mm Line : 275

  • (void)setTextHorizontalAlignment:(ax::TextHAlignment)alignment { // swizzle center & right, for some reason they're backwards on !TARGET_OS_IPHONE if (alignment == ax::TextHAlignment::CENTER) alignment = ax::TextHAlignment::RIGHT; else if (alignment == ax::TextHAlignment::RIGHT) alignment = ax::TextHAlignment::CENTER; self.textInput.ccui_alignment = static_cast<NSTextAlignment>(alignment); }

I don't know why they swizzle the center & right, but ax::TextHAlignment order is same as NSTextAlignment, (see picture) Untitled

this 4 line of code should remove, and macOS editbox will be correct align.

  • (void)setTextHorizontalAlignment:(ax::TextHAlignment)alignment { self.textInput.ccui_alignment = static_cast<NSTextAlignment>(alignment); }

Sevael avatar Jul 17 '24 03:07 Sevael