Fix Issue 30: Add bold/italic buttons for text elements
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@270 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -1360,6 +1360,45 @@ function SvgCanvas(c)
|
||||
this.setIdPrefix = function(p) {
|
||||
idprefix = p;
|
||||
};
|
||||
|
||||
this.getBold = function() {
|
||||
// should only have one element selected
|
||||
var selected = selectedElements[0];
|
||||
if (selected != null && selected.tagName == "text" &&
|
||||
selectedElements[1] == null)
|
||||
{
|
||||
return (selected.getAttribute("font-weight") == "bold");
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.setBold = function(b) {
|
||||
var selected = selectedElements[0];
|
||||
if (selected != null && selected.tagName == "text" &&
|
||||
selectedElements[1] == null)
|
||||
{
|
||||
selected.setAttribute("font-weight", b ? "bold" : "normal");
|
||||
}
|
||||
};
|
||||
|
||||
this.getItalic = function() {
|
||||
var selected = selectedElements[0];
|
||||
if (selected != null && selected.tagName == "text" &&
|
||||
selectedElements[1] == null)
|
||||
{
|
||||
return (selected.getAttribute("font-style") == "italic");
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.setItalic = function(i) {
|
||||
var selected = selectedElements[0];
|
||||
if (selected != null && selected.tagName == "text" &&
|
||||
selectedElements[1] == null)
|
||||
{
|
||||
selected.setAttribute("font-style", i ? "italic" : "normal");
|
||||
}
|
||||
};
|
||||
|
||||
this.getFontFamily = function() {
|
||||
return current_font_family;
|
||||
|
||||
Reference in New Issue
Block a user