Bug report about ccui.TextField
acrazing opened this issue · 1 comments
acrazing commented
ENV:
- .cocos-project.json
{ "engine_version": "cocos2d-x-3.17", "has_native": true, "project_type": "js" }
- project.json
{ "project_type": "javascript", "debugMode": 1, "showFPS": true, "frameRate": 60, "noCache": false, "id": "gameCanvas", "renderMode": 0, "engineDir": "frameworks/cocos2d-html5", "modules": [ "cocos2d", "ccui" ], "jsList": [ "src/resource.js", "src/app.js" ] }
Problems:
setContentSize/setTextAreaSize
does not work on any platformsetTextHorizontalAlignment/setTextVerticalAlignment
does not work on any platform if callsetAnchorPoint(0, 0)
, else works on iOS but does not work on mobile/pc browsers- long text(overflow) could not hide
- prompt input does not work on pc browser(Chrome)
- only if touches on the placeholder or text could attach IME
- IME does not hide when touches the area does not in the input box
The example code:
var input = new ccui.TextField('Please input text', void 0, 18 * 2);
input.setAnchorPoint(0.5, 0.5);
input.setTextAreaSize(cc.size(cc.sys.windowPixelResolution.width - 40, 30 * 2));
input.setPosition(cc.sys.windowPixelResolution.width / 2, cc.sys.windowPixelResolution.height - 200 + 30);
cc.sys.isNative || input.getVirtualRenderer().setTipMessage(input.getPlaceHolder());
input.setPlaceHolderColor(cc.color(0x99, 0x99, 0x99));
input.setTextColor(cc.color(0xff, 0xff, 0xff));
input.setTextHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);
input.setTextVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
this.addChild(input, 100);
The results:
The text at center on mobile browser
The text at left on mobile browser
acrazing commented