jtopo文字换行
来源:互联网 发布:linux循环 编辑:程序博客网 时间:2024/05/22 00:09
转自:http://blog.csdn.net/mytianhe/article/details/46559289
一、在jtopo.min.js文件中修改如下方法
this.paintText = function(a) {var b = this.text;if (null != b && "" != b) {a.beginPath(), a.font = this.font;var c = a.measureText(b).width,d = a.measureText("田").width;a.fillStyle = "rgba(" + this.fontColor + ", " + this.alpha + ")";ar e = this.getTextPostion(this.textPosition, c, d);a.fillText(b, e.x, e.y), a.closePath()}},
二、在jsp页面生成stage的前面添加如下代码
CanvasRenderingContext2D.prototype.wrapText = function(str,x,y){ var textArray = str.split('-'); //以-为换行符if(textArray==undefined||textArray==null)return false;var rowCnt = textArray.length;var i = 0,imax = rowCnt,maxLength = 0;maxText = textArray[0];for(;i<imax;i++){var nowText = textArray[i],textLength = nowText.length;if(textLength >=maxLength){maxLength = textLength; maxText = nowText;}}var maxWidth = this.measureText(maxText).width;var lineHeight = this.measureText("元").width;x+= lineHeight*(rowCnt-1)*1.7; //可以自己调节x、y位置for(var j= 0;j<textArray.length;j++){var words = textArray[j];this.fillText(words,x,y-textArray.length*lineHeight/2); y+= lineHeight;}};
0 0
- jtopo文字换行
- jtopo节点文字换行
- jtopo 告警 Alarm 换行 demo
- jtopo
- jTopo
- 文字换行
- 文字换行
- 文字换行
- 文字换行
- 链接提示文字换行
- J2ME文字自动换行
- 文字自动换行
- wxWidgets 按钮文字换行
- alert 文字换行
- CSS文字换行始末
- JLabel标签文字换行
- 文字换行StaticLayout
- Excel中文字换行
- 【Reversing.kr】Replace.exe
- 三月英语—不放弃!
- 【win32】标记菜单与对话框背景色
- ndk注册native方法关联
- Unstaisfiedlink error load jni.so failed
- jtopo文字换行
- 快速排序-《算法导论》学习笔记七
- 进口商贸易融资工具:减免保证金开证
- 多对多关系的处理办法
- 对原生组件开发的一点想法
- powderdesigner的基本使用所遇问题
- 使用JDBC操作数据库(Oracle,Mysql,SQLSERVER)
- Android 开发 对话框Dialog dismiss和hide方法的区别
- 浅谈C++,JAVA,Python类的简单编写比较