Permalink
Browse files

Release 0.0.4

  • Loading branch information...
1 parent 2924e9d commit 263ebc0af5dc0b0edd1f724ccc69a4768a8c3e24 @tj tj committed Sep 7, 2011
Showing with 21 additions and 10 deletions.
  1. +20 −9 build/texty.js
  2. +1 −1 build/texty.min.js
View
29 build/texty.js
@@ -644,29 +644,38 @@ Text.prototype.indexOf = function(x, y){
, size = this.lineHeight()
, lines = text.split('\n')
, height = lines.length * size
- , charWidth = width / text.length
, len = lines.length
, x = x - this.x
, y = y - this.y
+ , ctx = this.ctx
, pad = 10;
+ if (!text.length) return 0;
+
// x-axis out of bounds
if (x < -pad || x > width + pad) return 0;
// y-axis out of bounds
if (y < -pad || y > height + pad) return 0;
// cap y
- if (y < size) y = size;
- y = Math.ceil(y / size);
- if (y > len) y = len;
+ y = Math.ceil(Math.min(len, Math.max(1, y / size))) - 1;
- // guess index
- var preceding = lines.slice(0, y - 1).join('\n').length;
+ // preceding chars
+ var preceding = lines.slice(0, y).join('\n').length;
if (y) ++preceding;
- var i = Math.round(preceding + x / charWidth);
- return i;
+ // compute index
+ var line = lines[y]
+ , len = line.length
+ , width = 0;
+
+ for (var i = 0; i < len; ++i) {
+ width += ctx.measureText(line[i]).width;
+ if (width > x) break;
+ }
+
+ return i + preceding;
};
/**
@@ -933,11 +942,12 @@ Text.prototype.drawSelection = function(ctx, x, y, size, text){
Text.prototype.drawCaret = function(ctx, x, y, size, text){
if (!this.caret.visible) return;
var lines = text.substr(0, this.caret.pos).split('\n')
+ , lineHeight = this.lineHeight()
, len = lines.length
, line = lines[len - 1]
, px = size / 2
, caret = ctx.measureText(line).width + 2
- , y = y + --len * size;
+ , y = y + --len * lineHeight;
ctx.strokeStyle = this.caret._color;
ctx.beginPath();
ctx.moveTo(x + caret, y - px - 2);
@@ -1049,6 +1059,7 @@ Text.prototype.draw = function(ctx){
, x = this.x
, y = this.y;
+ this.ctx = ctx;
this._width = ctx.measureText(text).width;
ctx.textBaseline = 'middle';
ctx.font = size + 'px ' + this._families;
View
2 build/texty.min.js
@@ -1 +1 @@
--function(){Caret=function Caret(text){this.text=text,this.pos=0,this.color("#888"),this.softLeft=/([A-Z][a-z0-9]*|[a-z0-9]+|_+| +)$/,this.softRight=/^([A-Z][a-z0-9]*|[a-z0-9]+|_+| +)/,this.hardLeft=/(\w+| +)$/,this.hardRight=/^(\w+| +)/,this.show()},Caret.prototype.show=function(){this.visible=!0;return this},Caret.prototype.hide=function(){this.visible=!1;return this},Caret.prototype.color=function(color){if(!color)return this;this._color=color;return this},Caret.prototype.move=function(n){var len=this.text._text.length;this.pos+=n,this.pos<0?this.pos=0:this.pos>len&&(this.pos=len);return this},Caret.prototype.moveLeft=function(n){return this.move(-(n||1))},Caret.prototype.moveRight=function(n){return this.move(n||1)},Caret.prototype.moveUp=function(){var lines=this.text._text.slice(0,this.pos).split("\n"),curr=lines.pop(),prev=lines.pop()||"",n=prev.slice(curr.length).length;return this.moveLeft(curr.length+n+1)},Caret.prototype.moveDown=function(){var lines=this.text._text.slice(this.pos).split("\n"),curr=lines.shift(),next=lines.shift()||"",n=next.slice(curr.length).length;return this.moveRight(curr.length+n+1)},Caret.prototype.moveTo=function(x,y){2==arguments.length?this.moveTo(this.text.indexOf(x,y)):this.pos=x;return this},Caret.prototype.moveWithPattern=function(regexp,direction){var text=this.text._text,captures,n=1;-1==direction?text=text.slice(0,this.pos):text=text.slice(this.pos);if(captures=regexp.exec(text))n=captures[1].length;this.move(-1==direction?-n:n);return n},Caret.prototype.moveLeftSoft=function(){return this.moveWithPattern(this.softLeft,-1)},Caret.prototype.moveRightSoft=function(){return this.moveWithPattern(this.softRight,1)},Caret.prototype.moveLeftHard=function(){return this.moveWithPattern(this.hardLeft,-1)},Caret.prototype.moveRightHard=function(){return this.moveWithPattern(this.hardRight,1)}}(),-function(){function toArray(args){var ret=[];for(var i=0,len=args.length;i<len;++i)ret.push(args[i]);return ret}EventEmitter=function EventEmitter(){this.callbacks={}},EventEmitter.prototype.on=function(event,fn){(this.callbacks[event]=this.callbacks[event]||[]).push(fn);return this},EventEmitter.prototype.emit=function(event){var args=toArray(arguments).slice(1),callbacks=this.callbacks[event];if(callbacks)for(var i=0,len=callbacks.length;i<len;++i)callbacks[i].apply(this,args);return this}}(),-function(){selectorStyle=function style(selector,prop){var cache=style.cache=style.cache||{},cid=selector+":"+prop;if(cache[cid])return cache[cid];var parts=selector.split(/ +/),len=parts.length,parent=root=document.createElement("div"),child,part;for(var i=0;i<len;++i)part=parts[i],child=document.createElement("div"),parent.appendChild(child),parent=child,"#"==part[0]?child.setAttribute("id",part.substr(1)):"."==part[0]&&child.setAttribute("class",part.substr(1));document.body.appendChild(root);var ret=getComputedStyle(child)[prop];document.body.removeChild(root);return cache[cid]=ret}}(),-function(){Text=function Text(str){this.caret=new Caret(this),this.hide().text(str||""),this.clearCSS()},Text.prototype.clearCSS=function(){this.caret.color("#888"),this.listStyle("none").size(20).font("Helvetica").color("#000").selectionBackground("#DFF3FC").lineHeight(null)},Text.prototype.inheritCSS=function(){var s=selectorStyle;this.size(parseInt(s(".text","font-size"),10)).font(s(".text","font-family")).color(s(".text","color")).selectionBackground(s(".text .selection","background-color")),this.listStyle(s(".text .line","list-style-type")).lineHeight(parseInt(s(".text .line","line-height"),10)),this.caret.color(s(".text .caret","color"))},Text.prototype.lineHeight=function(n){if(0==arguments.length)return this._lineHeight||this._size;this._lineHeight=n;return this},Text.prototype.toString=function(){return this.text()},Text.prototype.listStyle=function(style){if(0==arguments.length)return this._listStyle;if(!style)return this;this._listStyle=style;return this},Text.prototype.text=function(str){if(arguments.length){this._text=str;return this}return this._text},Text.prototype.color=function(color){if(!color)return this;this._textColor=color;return this},Text.prototype.selectionBackground=function(color){if(!color)return this;this._selectionBackgroundColor=color;return this},Text.prototype.remove=function(n){return this.removeAt(n,this.caret.pos)},Text.prototype.removeAt=function(n,pos){this._text=this._text.substr(0,pos-n)+this._text.substr(pos);return this.caret.move(-n)},Text.prototype.removeRange=function(from,to){this._text=this._text.substr(0,from)+this._text.substr(to);return this.deselect().caret.moveTo(from)},Text.prototype.selection=function(){if(!!this.selected){var from=this.selected.from,to=this.selected.to;return{string:this._text.slice(from,to),from:from,to:to}}},Text.prototype.removeSelection=function(){if(!this.selected)throw new Error("no selection is made");var from=this.selected.from,to=this.selected.to;return this.removeRange(from,to)},Text.prototype.clear=function(){return this.text("")},Text.prototype.insert=function(str){return this.insertAt(str,this.caret.pos)},Text.prototype.insertAt=function(str,pos){this._text=this._text.substr(0,pos)+str+this._text.substr(pos);return this.caret.move(str.length)},Text.prototype.em=function(ctx){return ctx.measureText("M").width},Text.prototype.indexOf=function(x,y){var text=this.text(),width=this._width,size=this.lineHeight(),lines=text.split("\n"),height=lines.length*size,charWidth=width/text.length,len=lines.length,x=x-this.x,y=y-this.y,pad=10;if(x<-pad||x>width+pad)return 0;if(y<-pad||y>height+pad)return 0;y<size&&(y=size),y=Math.ceil(y/size),y>len&&(y=len);var preceding=lines.slice(0,y-1).join("\n").length;y&&++preceding;var i=Math.round(preceding+x/charWidth);return i},Text.prototype.select=function(x,y,x2,y2){var from=this.indexOf(x,y),to=this.indexOf(x2,y2);return this.selectRange(from,to).caret.moveTo(x2,y2).text},Text.prototype.selectWordAt=function(x,y){var i=this.indexOf(x,y);this.caret.moveTo(i);var left=this.caret.moveLeftHard();this.selectLeft(left),this.caret.moveTo(i);var right=this.caret.moveRightHard();this.selectRight(right),this.caret.moveTo(i);return this},Text.prototype.selectLeft=function(n){var pos=this.caret.pos,n=n||1,selection;(selection=this.selection())?this.selectRange(selection.from-n,selection.to):this.selectRange(pos,pos+n);return this},Text.prototype.selectRight=function(n){var pos=this.caret.pos,n=n||1,selection;(selection=this.selection())?this.selectRange(selection.from,selection.to+n):this.selectRange(pos-n,pos);return this},Text.prototype.selectAll=function(){return this.selectRange(0,this._text.length)},Text.prototype.selectRange=function(from,to){var len=this._text.length,tmp;from>to&&(tmp=from,from=to,to=tmp),this.selected={from:from>0?from:0,to:to<len?to:len};return this},Text.prototype.deselect=function(){this.selected=null;return this},Text.prototype.moveTo=function(x,y){this.x=x,this.y=y;return this},Text.prototype.hide=function(){this.visible=!1;return this},Text.prototype.show=function(){this.visible=!0;return this},Text.prototype.font=function(families){if(0==arguments.length)return this._families;if(!families)return this;this._families=families;return this},Text.prototype.size=function(n){if(0==arguments.length)return this._size;if(!n)return this;this._size=n;return this},Text.prototype.drawSelection=function(ctx,x,y,size,text){var selection=this.selection(),from=selection.from,to=selection.to,before=text.slice(0,from).split("\n"),beforeLen=before.length,last=before[beforeLen-1],selected=text.slice(from,to).split("\n"),selectionLen=selected.length,lineHeight=this.lineHeight(),px=size/2,ox=x,oy=y,width,line;ctx.fillStyle=this._selectionBackgroundColor,y+=(beforeLen-1)*lineHeight,width=ctx.measureText(selected[0]).width,last=ctx.measureText(last).width,ctx.fillRect(x+last,y-px,width,size);for(var i=1,len=selectionLen-1;i<len;++i)y+=lineHeight,width=ctx.measureText(selected[i]).width,ctx.fillRect(x,y-px,width,size);selectionLen<2||(y+=lineHeight,last=selected[selectionLen-1],width=ctx.measureText(last).width,ctx.fillRect(x,y-px,width,size))},Text.prototype.drawCaret=function(ctx,x,y,size,text){if(!!this.caret.visible){var lines=text.substr(0,this.caret.pos).split("\n"),len=lines.length,line=lines[len-1],px=size/2,caret=ctx.measureText(line).width+2,y=y+ --len*size;ctx.strokeStyle=this.caret._color,ctx.beginPath(),ctx.moveTo(x+caret,y-px-2),ctx.lineTo(x+caret,y+px+2),ctx.stroke()}},Text.prototype.drawText=function(ctx,x,y,size,text){var lines=text.split("\n"),lineHeight=this.lineHeight(),ox=x;ctx.fillStyle=this._textColor;for(var i=0,len=lines.length;i<len;++i)ctx.fillText(lines[i],x,y),x=ox,y+=lineHeight},Text.prototype.drawLineDecoration=function(ctx,x,y,size,text,c){var len=text.split("\n").length,lineHeight=this.lineHeight(),em=this.em(ctx);ctx.save(),ctx.font=this._size*.65+"px "+this._families,x-=em;for(var i=0;i<len;++i)ctx.fillText("function"==typeof c?c(i):c,x,y),y+=lineHeight;ctx.restore()},Text.prototype.bounds=function(ctx){var text=this._text,lines=text.split("\n"),size=Math.max(this._size,this.lineHeight()),height=size*lines.length,width=0,x=this.x,y=this.y;for(var i=0,len=lines.length;i<len;++i)width=Math.max(width,ctx.measureText(lines[i]).width);return{x:x,y:y-size/2,width:width,height:height}},Text.prototype.drawBounds=function(ctx){if(!this.visible)return this;var bounds=this.bounds(ctx);ctx.strokeStyle="rgba(255,0,0,.5)",ctx.strokeRect(bounds.x,bounds.y,bounds.width,bounds.height);return this},Text.prototype.draw=function(ctx){if(!this.visible)return this;var text=this._text,size=this._size,x=this.x,y=this.y;this._width=ctx.measureText(text).width,ctx.textBaseline="middle",ctx.font=size+"px "+this._families,this.selected&&this.drawSelection(ctx,x,y,size,text),this.drawCaret(ctx,x,y,size,text),this.drawText(ctx,x,y,size,text);var decoration;switch(this._listStyle){case"decimal":decoration=function(i){return++i+"."};break;case"square":decoration="■";break;case"circle":decoration="○";break;case"disc":decoration="●"}decoration&&this.drawLineDecoration(ctx,x,y,size,text,decoration);return this}}()
+-function(){Caret=function Caret(text){this.text=text,this.pos=0,this.color("#888"),this.softLeft=/([A-Z][a-z0-9]*|[a-z0-9]+|_+| +)$/,this.softRight=/^([A-Z][a-z0-9]*|[a-z0-9]+|_+| +)/,this.hardLeft=/(\w+| +)$/,this.hardRight=/^(\w+| +)/,this.show()},Caret.prototype.show=function(){this.visible=!0;return this},Caret.prototype.hide=function(){this.visible=!1;return this},Caret.prototype.color=function(color){if(!color)return this;this._color=color;return this},Caret.prototype.move=function(n){var len=this.text._text.length;this.pos+=n,this.pos<0?this.pos=0:this.pos>len&&(this.pos=len);return this},Caret.prototype.moveLeft=function(n){return this.move(-(n||1))},Caret.prototype.moveRight=function(n){return this.move(n||1)},Caret.prototype.moveUp=function(){var lines=this.text._text.slice(0,this.pos).split("\n"),curr=lines.pop(),prev=lines.pop()||"",n=prev.slice(curr.length).length;return this.moveLeft(curr.length+n+1)},Caret.prototype.moveDown=function(){var lines=this.text._text.slice(this.pos).split("\n"),curr=lines.shift(),next=lines.shift()||"",n=next.slice(curr.length).length;return this.moveRight(curr.length+n+1)},Caret.prototype.moveTo=function(x,y){2==arguments.length?this.moveTo(this.text.indexOf(x,y)):this.pos=x;return this},Caret.prototype.moveWithPattern=function(regexp,direction){var text=this.text._text,captures,n=1;-1==direction?text=text.slice(0,this.pos):text=text.slice(this.pos);if(captures=regexp.exec(text))n=captures[1].length;this.move(-1==direction?-n:n);return n},Caret.prototype.moveLeftSoft=function(){return this.moveWithPattern(this.softLeft,-1)},Caret.prototype.moveRightSoft=function(){return this.moveWithPattern(this.softRight,1)},Caret.prototype.moveLeftHard=function(){return this.moveWithPattern(this.hardLeft,-1)},Caret.prototype.moveRightHard=function(){return this.moveWithPattern(this.hardRight,1)}}(),-function(){function toArray(args){var ret=[];for(var i=0,len=args.length;i<len;++i)ret.push(args[i]);return ret}EventEmitter=function EventEmitter(){this.callbacks={}},EventEmitter.prototype.on=function(event,fn){(this.callbacks[event]=this.callbacks[event]||[]).push(fn);return this},EventEmitter.prototype.emit=function(event){var args=toArray(arguments).slice(1),callbacks=this.callbacks[event];if(callbacks)for(var i=0,len=callbacks.length;i<len;++i)callbacks[i].apply(this,args);return this}}(),-function(){selectorStyle=function style(selector,prop){var cache=style.cache=style.cache||{},cid=selector+":"+prop;if(cache[cid])return cache[cid];var parts=selector.split(/ +/),len=parts.length,parent=root=document.createElement("div"),child,part;for(var i=0;i<len;++i)part=parts[i],child=document.createElement("div"),parent.appendChild(child),parent=child,"#"==part[0]?child.setAttribute("id",part.substr(1)):"."==part[0]&&child.setAttribute("class",part.substr(1));document.body.appendChild(root);var ret=getComputedStyle(child)[prop];document.body.removeChild(root);return cache[cid]=ret}}(),-function(){Text=function Text(str){this.caret=new Caret(this),this.hide().text(str||""),this.clearCSS()},Text.prototype.clearCSS=function(){this.caret.color("#888"),this.listStyle("none").size(20).font("Helvetica").color("#000").selectionBackground("#DFF3FC").lineHeight(null)},Text.prototype.inheritCSS=function(){var s=selectorStyle;this.size(parseInt(s(".text","font-size"),10)).font(s(".text","font-family")).color(s(".text","color")).selectionBackground(s(".text .selection","background-color")),this.listStyle(s(".text .line","list-style-type")).lineHeight(parseInt(s(".text .line","line-height"),10)),this.caret.color(s(".text .caret","color"))},Text.prototype.lineHeight=function(n){if(0==arguments.length)return this._lineHeight||this._size;this._lineHeight=n;return this},Text.prototype.toString=function(){return this.text()},Text.prototype.listStyle=function(style){if(0==arguments.length)return this._listStyle;if(!style)return this;this._listStyle=style;return this},Text.prototype.text=function(str){if(arguments.length){this._text=str;return this}return this._text},Text.prototype.color=function(color){if(!color)return this;this._textColor=color;return this},Text.prototype.selectionBackground=function(color){if(!color)return this;this._selectionBackgroundColor=color;return this},Text.prototype.remove=function(n){return this.removeAt(n,this.caret.pos)},Text.prototype.removeAt=function(n,pos){this._text=this._text.substr(0,pos-n)+this._text.substr(pos);return this.caret.move(-n)},Text.prototype.removeRange=function(from,to){this._text=this._text.substr(0,from)+this._text.substr(to);return this.deselect().caret.moveTo(from)},Text.prototype.selection=function(){if(!!this.selected){var from=this.selected.from,to=this.selected.to;return{string:this._text.slice(from,to),from:from,to:to}}},Text.prototype.removeSelection=function(){if(!this.selected)throw new Error("no selection is made");var from=this.selected.from,to=this.selected.to;return this.removeRange(from,to)},Text.prototype.clear=function(){return this.text("")},Text.prototype.insert=function(str){return this.insertAt(str,this.caret.pos)},Text.prototype.insertAt=function(str,pos){this._text=this._text.substr(0,pos)+str+this._text.substr(pos);return this.caret.move(str.length)},Text.prototype.em=function(ctx){return ctx.measureText("M").width},Text.prototype.indexOf=function(x,y){var text=this.text(),width=this._width,size=this.lineHeight(),lines=text.split("\n"),height=lines.length*size,len=lines.length,x=x-this.x,y=y-this.y,ctx=this.ctx,pad=10;if(!text.length)return 0;if(x<-pad||x>width+pad)return 0;if(y<-pad||y>height+pad)return 0;y=Math.ceil(Math.min(len,Math.max(1,y/size)))-1;var preceding=lines.slice(0,y).join("\n").length;y&&++preceding;var line=lines[y],len=line.length,width=0;for(var i=0;i<len;++i){width+=ctx.measureText(line[i]).width;if(width>x)break}return i+preceding},Text.prototype.select=function(x,y,x2,y2){var from=this.indexOf(x,y),to=this.indexOf(x2,y2);return this.selectRange(from,to).caret.moveTo(x2,y2).text},Text.prototype.selectWordAt=function(x,y){var i=this.indexOf(x,y);this.caret.moveTo(i);var left=this.caret.moveLeftHard();this.selectLeft(left),this.caret.moveTo(i);var right=this.caret.moveRightHard();this.selectRight(right),this.caret.moveTo(i);return this},Text.prototype.selectLeft=function(n){var pos=this.caret.pos,n=n||1,selection;(selection=this.selection())?this.selectRange(selection.from-n,selection.to):this.selectRange(pos,pos+n);return this},Text.prototype.selectRight=function(n){var pos=this.caret.pos,n=n||1,selection;(selection=this.selection())?this.selectRange(selection.from,selection.to+n):this.selectRange(pos-n,pos);return this},Text.prototype.selectAll=function(){return this.selectRange(0,this._text.length)},Text.prototype.selectRange=function(from,to){var len=this._text.length,tmp;from>to&&(tmp=from,from=to,to=tmp),this.selected={from:from>0?from:0,to:to<len?to:len};return this},Text.prototype.deselect=function(){this.selected=null;return this},Text.prototype.moveTo=function(x,y){this.x=x,this.y=y;return this},Text.prototype.hide=function(){this.visible=!1;return this},Text.prototype.show=function(){this.visible=!0;return this},Text.prototype.font=function(families){if(0==arguments.length)return this._families;if(!families)return this;this._families=families;return this},Text.prototype.size=function(n){if(0==arguments.length)return this._size;if(!n)return this;this._size=n;return this},Text.prototype.drawSelection=function(ctx,x,y,size,text){var selection=this.selection(),from=selection.from,to=selection.to,before=text.slice(0,from).split("\n"),beforeLen=before.length,last=before[beforeLen-1],selected=text.slice(from,to).split("\n"),selectionLen=selected.length,lineHeight=this.lineHeight(),px=size/2,ox=x,oy=y,width,line;ctx.fillStyle=this._selectionBackgroundColor,y+=(beforeLen-1)*lineHeight,width=ctx.measureText(selected[0]).width,last=ctx.measureText(last).width,ctx.fillRect(x+last,y-px,width,size);for(var i=1,len=selectionLen-1;i<len;++i)y+=lineHeight,width=ctx.measureText(selected[i]).width,ctx.fillRect(x,y-px,width,size);selectionLen<2||(y+=lineHeight,last=selected[selectionLen-1],width=ctx.measureText(last).width,ctx.fillRect(x,y-px,width,size))},Text.prototype.drawCaret=function(ctx,x,y,size,text){if(!!this.caret.visible){var lines=text.substr(0,this.caret.pos).split("\n"),lineHeight=this.lineHeight(),len=lines.length,line=lines[len-1],px=size/2,caret=ctx.measureText(line).width+2,y=y+ --len*lineHeight;ctx.strokeStyle=this.caret._color,ctx.beginPath(),ctx.moveTo(x+caret,y-px-2),ctx.lineTo(x+caret,y+px+2),ctx.stroke()}},Text.prototype.drawText=function(ctx,x,y,size,text){var lines=text.split("\n"),lineHeight=this.lineHeight(),ox=x;ctx.fillStyle=this._textColor;for(var i=0,len=lines.length;i<len;++i)ctx.fillText(lines[i],x,y),x=ox,y+=lineHeight},Text.prototype.drawLineDecoration=function(ctx,x,y,size,text,c){var len=text.split("\n").length,lineHeight=this.lineHeight(),em=this.em(ctx);ctx.save(),ctx.font=this._size*.65+"px "+this._families,x-=em;for(var i=0;i<len;++i)ctx.fillText("function"==typeof c?c(i):c,x,y),y+=lineHeight;ctx.restore()},Text.prototype.bounds=function(ctx){var text=this._text,lines=text.split("\n"),size=Math.max(this._size,this.lineHeight()),height=size*lines.length,width=0,x=this.x,y=this.y;for(var i=0,len=lines.length;i<len;++i)width=Math.max(width,ctx.measureText(lines[i]).width);return{x:x,y:y-size/2,width:width,height:height}},Text.prototype.drawBounds=function(ctx){if(!this.visible)return this;var bounds=this.bounds(ctx);ctx.strokeStyle="rgba(255,0,0,.5)",ctx.strokeRect(bounds.x,bounds.y,bounds.width,bounds.height);return this},Text.prototype.draw=function(ctx){if(!this.visible)return this;var text=this._text,size=this._size,x=this.x,y=this.y;this.ctx=ctx,this._width=ctx.measureText(text).width,ctx.textBaseline="middle",ctx.font=size+"px "+this._families,this.selected&&this.drawSelection(ctx,x,y,size,text),this.drawCaret(ctx,x,y,size,text),this.drawText(ctx,x,y,size,text);var decoration;switch(this._listStyle){case"decimal":decoration=function(i){return++i+"."};break;case"square":decoration="■";break;case"circle":decoration="○";break;case"disc":decoration="●"}decoration&&this.drawLineDecoration(ctx,x,y,size,text,decoration);return this}}()

0 comments on commit 263ebc0

Please sign in to comment.