@@ -200,8 +200,8 @@ var StyleOpType;
200200} ) ( StyleOpType || ( StyleOpType = { } ) ) ;
201201var Element = /** @class */ ( function ( ) {
202202 function Element ( _a ) {
203- var _this = this ;
204203 var _b = _a . style , style = _b === void 0 ? { } : _b , _c = _a . idName , idName = _c === void 0 ? '' : _c , _d = _a . className , className = _d === void 0 ? '' : _d , _e = _a . id , id = _e === void 0 ? uuid += 1 : _e , _f = _a . dataset , dataset = _f === void 0 ? { } : _f ;
204+ var _this = this ;
205205 /**
206206 * 子节点列表
207207 */
@@ -2461,12 +2461,12 @@ var defaultOptions = {
24612461 textNodeName : '#text' ,
24622462 ignoreAttributes : true ,
24632463 ignoreNameSpace : false ,
2464- allowBooleanAttributes : false ,
2464+ allowBooleanAttributes : false , //a tag can have attributes without any value
24652465 //ignoreRootElement : false,
24662466 parseNodeValue : true ,
24672467 parseAttributeValue : false ,
24682468 arrayMode : false ,
2469- trimValues : true ,
2469+ trimValues : true , //Trim string values of tag and attributes
24702470 cdataTagName : false ,
24712471 cdataPositionChar : '\\c' ,
24722472 localeRange : '' ,
@@ -2713,7 +2713,7 @@ module.exports = function (tagname, parent, val) {
27132713
27142714var util = __webpack_require__ ( 13 ) ;
27152715var defaultOptions = {
2716- allowBooleanAttributes : false ,
2716+ allowBooleanAttributes : false , //A tag can have attributes without any value
27172717 localeRange : 'a-zA-Z' ,
27182718} ;
27192719var props = [ 'allowBooleanAttributes' , 'localeRange' ] ;
@@ -3798,8 +3798,8 @@ function parseText(style, value) {
37983798var Text = /** @class */ ( function ( _super ) {
37993799 __extends ( Text , _super ) ;
38003800 function Text ( _a ) {
3801- var _this = this ;
38023801 var _b = _a . style , style = _b === void 0 ? { } : _b , _c = _a . idName , idName = _c === void 0 ? '' : _c , _d = _a . className , className = _d === void 0 ? '' : _d , _e = _a . value , value = _e === void 0 ? '' : _e , dataset = _a . dataset ;
3802+ var _this = this ;
38033803 var originStyleWidth = style . width ;
38043804 // 没有设置宽度的时候通过canvas计算出文字宽度
38053805 if ( originStyleWidth === undefined ) {
@@ -5473,8 +5473,8 @@ function checkNeedHideScrollBar(direction, dimensions) {
54735473var ScrollBar = /** @class */ ( function ( _super ) {
54745474 __extends ( ScrollBar , _super ) ;
54755475 function ScrollBar ( _a ) {
5476+ var direction = _a . direction , dimensions = _a . dimensions , _b = _a . backgroundColor , backgroundColor = _b === void 0 ? 'rgba(162, 162, 162, 0.7)' : _b , _c = _a . width , width = _c === void 0 ? 10 : _c ;
54765477 var _this = this ;
5477- var direction = _a . direction , dimensions = _a . dimensions , _b = _a . backgroundColor , backgroundColor = _b === void 0 ? 'rgba(162, 162, 162, 1)' : _b , _c = _a . width , width = _c === void 0 ? 16 : _c ;
54785478 var style = Object . assign ( {
54795479 backgroundColor : backgroundColor ,
54805480 position : 'absolute' ,
@@ -5490,7 +5490,7 @@ var ScrollBar = /** @class */ (function (_super) {
54905490 _this . autoHideTime = 2000 ;
54915491 _this . autoHideDelayTime = 1500 ;
54925492 _this . autoHideRemainingTime = 0 ;
5493- _this . innerWidth = 16 ;
5493+ _this . innerWidth = 10 ;
54945494 _this . isHide = false ;
54955495 _this . currLeft = 0 ;
54965496 _this . currTop = 0 ;
@@ -5722,11 +5722,16 @@ var BitMapText = /** @class */ (function (_super) {
57225722 var style = this . style ;
57235723 var _a = style . letterSpacing , letterSpacing = _a === void 0 ? 0 : _a ;
57245724 var width = 0 ;
5725+ // 记录上一个字符,方便处理 kerning
5726+ var prevCharCode = null ;
57255727 for ( var i = 0 , len = this . value . length ; i < len ; i ++ ) {
57265728 var char = this . value [ i ] ;
57275729 var cfg = this . font . chars [ char ] ;
57285730 if ( cfg ) {
5729- width += cfg . w ;
5731+ if ( prevCharCode && cfg . kerning [ prevCharCode ] ) {
5732+ width += cfg . kerning [ prevCharCode ] ;
5733+ }
5734+ width += cfg . xadvance ;
57305735 if ( i < len - 1 ) {
57315736 width += letterSpacing ;
57325737 }
@@ -5763,7 +5768,7 @@ var BitMapText = /** @class */ (function (_super) {
57635768 drawX += ( width - realWidth ) / 2 ;
57645769 }
57655770 else if ( textAlign === 'right' ) {
5766- drawY += ( width - realWidth ) ;
5771+ drawX += ( width - realWidth ) ;
57675772 }
57685773 }
57695774 // 记录上一个字符,方便处理 kerning
@@ -6140,7 +6145,7 @@ var Layout = /** @class */ (function (_super) {
61406145 /**
61416146 * 当前 Layout 版本,一般跟小游戏插件版本对齐
61426147 */
6143- _this . version = '1.0.11 ' ;
6148+ _this . version = '1.0.12 ' ;
61446149 _this . env = _env__WEBPACK_IMPORTED_MODULE_0__ [ "default" ] ;
61456150 /**
61466151 * Layout 渲染的目标画布对应的 2d context
@@ -6297,7 +6302,7 @@ var Layout = /** @class */ (function (_super) {
62976302 debugInfo . start ( 'init' ) ;
62986303 var parseConfig = {
62996304 attributeNamePrefix : '' ,
6300- attrNodeName : 'attr' ,
6305+ attrNodeName : 'attr' , // default is 'false'
63016306 textNodeName : '#text' ,
63026307 ignoreAttributes : false ,
63036308 ignoreNameSpace : true ,
0 commit comments