cocos2d/cocos2d-html5

Bug report about ccui.TextField

acrazing opened this issue · 1 comments

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:

  1. setContentSize/setTextAreaSize does not work on any platform
  2. setTextHorizontalAlignment/setTextVerticalAlignment does not work on any platform if call setAnchorPoint(0, 0), else works on iOS but does not work on mobile/pc browsers
  3. long text(overflow) could not hide
  4. prompt input does not work on pc browser(Chrome)
  5. only if touches on the placeholder or text could attach IME
  6. 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:

wechatimg20
The text at center on mobile browser

wechatimg19
The text at left on mobile browser

wechatimg18
The text at center on iOS

wechatimg17
The placeholder at center on iOS

wechatimg16
The input text still show when overflow