axmol
axmol copied to clipboard
macOS Edit wrong alignment
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)
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); }