多謝Luar的指點和分享這些代碼,困擾的中文輸入會影響表情定位的問題終於解決了。
在組件代碼中updatePixelPos方法找到
替換成下面這段代碼:
2 : // Because all English Characters' width is stored in Array
3 : // If return undefined, it is Chinese character,
4 : // Hardcode Chinese character width = 13
5 : //*************************************************************
6 : var ccWIDTH = this.CHAR_WIDTH_MAP[Math.min(1, this.is_bold)][string.charCodeAt(pos)];
7 : ccWIDTH = (ccWIDTH == undefined) ? 13 : ccWIDTH;//這行就是解決問題的所在
8 : this.pixel_pos += ccWIDTH;
然後在parseHtmlShortcuts方法中找到
替換成下面代碼:
// Because all English Characters' width is stored in Array
// If return undefined, it is Chinese character,
// Hardcode Chinese character width = 13
//*************************************************************
var ccWIDTH = this.CHAR_WIDTH_MAP[Math.min(1, this.is_bold)][shortcut_str.charCodeAt(j)];
ccWIDTH = (ccWIDTH == undefined) ? 13 : ccWIDTH;
test_pos += ccWIDTH;
//
以上均引用luar的修改代碼,非常感謝luar!