使用滑块增加文本的宽度 [英] Increase the width of the text by using slider
本文介绍了使用滑块增加文本的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨所有,
im使用滑块但是他们在增加尺寸问题时出现了一些错误: - 当我增加文本的大小时,它需要使用前一个大小的值示例: -
首先写入任何大小的文本之后我设置大小10之后再次设置大小20然后它取大小10如果我的尺寸是35,然后尺寸为20,所以就这样发生了
所以请尽快帮助我。
hi All,
i m using the slider but their is some mistake in increase the size problem is :- when i increase the size of the text it take the previous value of the size Example:-
First write the text any size after that i set the size 10 after that again set the size 20 then it take the size 10 if i take the size 35 then it take the size 20 so similarly this is happened
so please help me asap.
$("#Textslider").change(function () {
var textsize = null;
if (getSelectedLayer() != null) {
textsize = $(this).val();
var canvasobj = getSelectedLayer();
canvasobj.fontSize = textsize;
this.context = canvasobj.context;
this.textWidth = this.context.measureText(canvasobj.content).width;
this.textHeight = (parseInt(textsize) + (textsize / 4));
jCollage.TextResize(this.textWidth, this.textHeight, textsize, canvasobj, this.context);
//jCollage.redraw();
}
});
this.TextResize = function (textWidth, textHeight, fontSize, selectedLayer, context) {
this.fontSize = fontSize;
this.selectedLayer = selectedLayer;
this.context = context;
this.textWidth = textWidth;
this.textHeight = textHeight;
this.selectedLayer.scale(parseInt(this.textWidth + 30), this.textHeight);
drawMarker(this.selectedLayer);
}
推荐答案
( #Textslider)。change( function (){
var textsize = null ;
if (getSelectedLayer()!= null ){
textsize =
("#Textslider").change(function () { var textsize = null; if (getSelectedLayer() != null) { textsize =
( this )。val( );
var canvasobj = getSelectedLayer();
canvasobj.fontSize = textsize;
this .context = canvasobj.context;
this .textWidth = this .context.measureText(canvasobj.content).width;
this .textHeight =( parseInt (textsize)+(textsize / 4 ));
jCollage.TextResize( this .textWidth, this .textHeight,textsize, canvasobj, this .context);
// jCollage.redraw();
}
} );
this .TextResize = function (textWidth,textHeight,fontSize,selectedLayer,上下文){
this .fontSize = fontSize;
此 .selectedLayer = selectedLayer;
此 .context = context;
此 .textWidth = textWidth;
此 .textHeight = textHeight;
此 .selectedLayer.scale( parseInt ( this .textWidth + 30 ), this .textHeight);
drawMarker( this .selectedLayer);
}
(this).val(); var canvasobj = getSelectedLayer(); canvasobj.fontSize = textsize; this.context = canvasobj.context; this.textWidth = this.context.measureText(canvasobj.content).width; this.textHeight = (parseInt(textsize) + (textsize / 4)); jCollage.TextResize(this.textWidth, this.textHeight, textsize, canvasobj, this.context); //jCollage.redraw(); } }); this.TextResize = function (textWidth, textHeight, fontSize, selectedLayer, context) { this.fontSize = fontSize; this.selectedLayer = selectedLayer; this.context = context; this.textWidth = textWidth; this.textHeight = textHeight; this.selectedLayer.scale(parseInt(this.textWidth + 30), this.textHeight); drawMarker(this.selectedLayer); }
这篇关于使用滑块增加文本的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文