【问题标题】:How to make cursor go to new line while typing on pressing enter in EaselJS如何在 EaselJS 中按 Enter 键时使光标转到新行
【发布时间】:2016-10-04 12:08:54
【问题描述】:

我正在从输入字段中获取输入并使用 onkeyup 在画布中更新它

var inputText = document.getElementById("input");
var text = new createjs.Text();
text.set({
  text: inputText.value,
  textAlign: "center",
  textBaseline: "middle",
  x: 100,
  y: 100
});
stage.addChild(text);
stage.update();
inputText.onkeyup = function(){
  text.set({
    text: inputText.value
  })
  stage.update();
}

当我在输入时按回车时,如何让这个文本换行到下一行?

【问题讨论】:

    标签: javascript canvas createjs easeljs


    【解决方案1】:

    input 元素是单行的,你可以使用textarea 来实现它。 Here 是一个简单的例子来说明这一点

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-30
      • 1970-01-01
      • 2014-09-16
      • 2013-06-09
      • 2013-06-13
      相关资源
      最近更新 更多