Changed font drop-down list to spinner, now uses px rather than pt
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@849 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
39e71579e3
commit
a0d4f0e263
|
@ -229,23 +229,8 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
|
|||
<option value="fantasy">fantasy</option>
|
||||
<option value="monospace">monospace</option>
|
||||
</select>
|
||||
<select id="font_size" class="text_tool" title="Change Font Size">
|
||||
<option value="6pt">6pt</option>
|
||||
<option value="8pt">8pt</option>
|
||||
<option value="10pt">10pt</option>
|
||||
<option selected="selected" value="12pt">12pt</option>
|
||||
<option value="14pt">14pt</option>
|
||||
<option value="16pt">16pt</option>
|
||||
<option value="20pt">20pt</option>
|
||||
<option value="24pt">24pt</option>
|
||||
<option value="32pt">32pt</option>
|
||||
<option value="48pt">48pt</option>
|
||||
<option value="64pt">64pt</option>
|
||||
<option value="72pt">72pt</option>
|
||||
<option value="80pt">80pt</option>
|
||||
<option value="96pt">96pt</option>
|
||||
<option value="120pt">120pt</option>
|
||||
</select>
|
||||
<span id="font_sizeLabel" class="text_tool">size:</span>
|
||||
<input id="font_size" class="text_tool" title="Change Font Size" size="3" value="0" type="text"/>
|
||||
<input id="text" class="text_tool" type="text" title="Change text contents" size="35"/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -339,6 +339,10 @@ function svg_edit_setup() {
|
|||
svgCanvas.setRectRadius(ctl.value);
|
||||
}
|
||||
|
||||
var changeFontSize = function(ctl) {
|
||||
svgCanvas.setFontSize(ctl.value);
|
||||
}
|
||||
|
||||
var changeStrokeWidth = function(ctl) {
|
||||
var val = ctl.value;
|
||||
if(val == 0 && selectedElement && $.inArray(selectedElement.nodeName, ['line', 'polyline']) != -1) {
|
||||
|
@ -383,10 +387,6 @@ function svg_edit_setup() {
|
|||
}
|
||||
});
|
||||
|
||||
$('#font_size').change(function(){
|
||||
svgCanvas.setFontSize(this.options[this.selectedIndex].value);
|
||||
});
|
||||
|
||||
$('#font_family').change(function(){
|
||||
svgCanvas.setFontFamily(this.options[this.selectedIndex].value);
|
||||
});
|
||||
|
@ -1434,6 +1434,28 @@ function svg_edit_setup() {
|
|||
|
||||
$(window).resize( centerCanvasIfNeeded );
|
||||
|
||||
function stepFontSize(elem, step) {
|
||||
var orig_val = elem.value-0;
|
||||
var sug_val = orig_val + step;
|
||||
var increasing = sug_val >= orig_val;
|
||||
|
||||
if(orig_val >= 24) {
|
||||
if(increasing) {
|
||||
return Math.round(orig_val * 1.1);
|
||||
} else {
|
||||
return Math.round(orig_val / 1.1);
|
||||
}
|
||||
} else if(orig_val <= 1) {
|
||||
if(increasing) {
|
||||
return orig_val * 2;
|
||||
} else {
|
||||
return orig_val / 2;
|
||||
}
|
||||
} else {
|
||||
return sug_val;
|
||||
}
|
||||
}
|
||||
|
||||
function stepZoom(elem, step) {
|
||||
var orig_val = elem.value-0;
|
||||
var sug_val = orig_val + step;
|
||||
|
@ -1494,7 +1516,8 @@ function svg_edit_setup() {
|
|||
$('#rect_rx').SpinButton({ min: 0, max: 1000, step: 1, callback: changeRectRadius });
|
||||
$('#stroke_width').SpinButton({ min: 0, max: 99, step: 1, callback: changeStrokeWidth });
|
||||
$('#angle').SpinButton({ min: -180, max: 180, step: 5, callback: changeRotationAngle });
|
||||
$('#zoom').SpinButton({ min: 0.1, max: 10000, step: 50, stepfunc: stepZoom, callback: changeZoom });
|
||||
$('#font_size').SpinButton({ step: 1, min: 0.001, stepfunc: stepFontSize, callback: changeFontSize });
|
||||
$('#zoom').SpinButton({ min: 0.001, max: 10000, step: 50, stepfunc: stepZoom, callback: changeZoom });
|
||||
|
||||
svgCanvas.setCustomHandlers = function(opts) {
|
||||
if(opts.open) {
|
||||
|
|
|
@ -695,7 +695,7 @@ function BatchCommand(text) {
|
|||
$.extend(all_properties.text, {
|
||||
fill: "#000000",
|
||||
stroke_width: 0,
|
||||
font_size: '12pt',
|
||||
font_size: 24,
|
||||
font_family: 'serif'
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue