$.widget("ui.textNode",$.ui.sceneResource,{options:{data:null,parent:null,zoom:$.noop,onupdate:$.noop,ondelete:$.noop,addHistory:$.noop},category:"texts",defaultValues:{type:"",id:"",rotation:0,opacity:1,zIndex:0,position:{x:0,y:0},size:{width:200,height:100},text:{"zh-CN":"","en-US":""},check:!1,speed:"general",font:$.utils.defaultFont,hiddenAtStart:!1},sourceProp:["text","size","font","check","speed"],needToUpdateJson:!0,getRate:function(){return 1},getCurrentData:function(){var t={id:this.id(),type:this.type(),position:this.position(),size:this.size(),text:this.text(),font:this.font()},e=this.hiddenAtStart();e&&(t.hiddenAtStart=e);var e=this.check();if(e){t.check=e;t.speed=this.speed()}e=this.rotation();e&&(t.rotation=e);this.options.data.first&&(t.first=!0);return t},text:function(t){var e=this.elementData("text",t);if(void 0===t)return e;this.updatePreview();return void 0},check:function(t){var e=this.elementData("check",t);if(void 0===t)return e;this.updatePreview();return void 0},speed:function(t){var e=this.elementData("speed",t);if(void 0===t)return e;this.updatePreview();return void 0},font:function(t){var e=this.elementData("font",t);if(void 0===t)return e;this.updatePreview();return void 0},update:function(t,e,i){if("texts"===t&&this.type()===i){this.type(i);var o=this.element.data("data");if(o&&o.first){var n=$.utils.getResourceData(this.category,this.type()),s=this.defaultValues;this.sourceProp.forEach(function(t){o[t]||(o[t]=n[t]||s[t])})}this.updatePreview();this.isSelected()&&this.onselect()}},updatePreview:function(){var t=this.$inner,e=this.zoomValue||this.options.get("zoom"),i=$.utils.getResourceData(this.category,this.type()),o=this.size()||i.size||{},n=this.text()||i.text||{},s=this.font()||i.font;"string"==typeof s&&(s=$.utils.getResourceData("fonts",s));s||(s=$.utils.defaultFont);var a="";if(void 0!==n["zh-CN"]){n["zh-CN"]+="";a=n["zh-CN"].replace($.utils.pauseTagRegex,"")}t.text(a).css({width:o.width*e,height:o.height*e,"font-weight":s.fontWeight,"font-style":s.fontStyle,"font-family":s.fontFamily,"text-align":s.align,"font-size":s.fontSize*e,padding:s.padding*e,color:s.fontColor,"line-height":s.lineHeight})}});