Started conversion of stroke attribute select list to icon list
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1503 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -310,6 +310,10 @@
|
||||
'#tool_alignmiddle':'align_middle',
|
||||
'#tool_alignbottom':'align_bottom',
|
||||
|
||||
'#linecap_butt,#cur_linecap':'linecap_butt',
|
||||
'#linecap_round':'linecap_round',
|
||||
'#linecap_square':'linecap_square',
|
||||
|
||||
'#url_notice':'warning',
|
||||
|
||||
'#layer_up':'go_up',
|
||||
@@ -330,7 +334,8 @@
|
||||
'.dropdown button .svg_icon': 7,
|
||||
'#main_button .dropdown .svg_icon': 9,
|
||||
'.palette_item:first .svg_icon, #fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
|
||||
'.toolbar_button button .svg_icon':16
|
||||
'.toolbar_button button .svg_icon':16,
|
||||
'.stroke_tool div div .svg_icon': 20
|
||||
},
|
||||
callback: function(icons) {
|
||||
$('.toolbar_button button > svg, .toolbar_button button > img').each(function() {
|
||||
@@ -1016,7 +1021,10 @@
|
||||
$('#stroke_width').val(selectedElement.getAttribute("stroke-width")||1);
|
||||
$('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none");
|
||||
$('#stroke_linejoin').val(selectedElement.getAttribute("stroke-linejoin")||"miter");
|
||||
$('#stroke_linecap').val(selectedElement.getAttribute("stroke-linecap")||"butt");
|
||||
// $('#stroke_linecap').val(selectedElement.getAttribute("stroke-linecap")||"butt");
|
||||
|
||||
var attr = selectedElement.getAttribute("stroke-linecap") || 'butt';
|
||||
$('#linecap_' + attr).mouseup();
|
||||
}
|
||||
|
||||
// All elements including image and group have opacity
|
||||
@@ -1297,10 +1305,10 @@
|
||||
operaRepaint();
|
||||
});
|
||||
|
||||
$('#stroke_linecap').change(function(){
|
||||
svgCanvas.setStrokeAttr('stroke-linecap', $(this).val());
|
||||
operaRepaint();
|
||||
});
|
||||
// $('#stroke_linecap').change(function(){
|
||||
// svgCanvas.setStrokeAttr('stroke-linecap', $(this).val());
|
||||
// operaRepaint();
|
||||
// });
|
||||
|
||||
|
||||
// Lose focus for select elements when changed (Allows keyboard shortcuts to work better)
|
||||
@@ -1584,6 +1592,55 @@
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Combine this with addDropDown or find other way to optimize
|
||||
var addAltDropDown = function(elem, list, callback, dropUp) {
|
||||
var button = $(elem);
|
||||
var list = $(list);
|
||||
var on_button = false;
|
||||
if(dropUp) {
|
||||
$(elem).addClass('dropup');
|
||||
}
|
||||
|
||||
list.find('li').bind('mouseup', function() {
|
||||
callback.apply(this, arguments);
|
||||
$(this).addClass('current').siblings().removeClass('current');
|
||||
});
|
||||
|
||||
$(window).mouseup(function(evt) {
|
||||
if(!on_button) {
|
||||
button.removeClass('down');
|
||||
list.hide();
|
||||
list.css({top:0, left:0});
|
||||
}
|
||||
on_button = false;
|
||||
});
|
||||
|
||||
var height = list.height();
|
||||
|
||||
$(elem).bind('mousedown',function() {
|
||||
var off = $(elem).offset();
|
||||
off.top -= list.height();
|
||||
off.left += 8;
|
||||
$(list).offset(off);
|
||||
|
||||
if (!button.hasClass('down')) {
|
||||
button.addClass('down');
|
||||
list.show();
|
||||
on_button = true;
|
||||
return false;
|
||||
} else {
|
||||
button.removeClass('down');
|
||||
// CSS position must be reset for Webkit
|
||||
list.hide();
|
||||
list.css({top:0, left:0});
|
||||
}
|
||||
}).hover(function() {
|
||||
on_button = true;
|
||||
}).mouseout(function() {
|
||||
on_button = false;
|
||||
});
|
||||
}
|
||||
|
||||
addDropDown('#font_family_dropdown', function() {
|
||||
var fam = $(this).text();
|
||||
$('#font_family').val($(this).text()).change();
|
||||
@@ -1619,6 +1676,19 @@
|
||||
}
|
||||
}, true);
|
||||
|
||||
// $('#cur_linecap').mousedown(function() {
|
||||
// $('#linecap_opts').show();
|
||||
// });
|
||||
|
||||
addAltDropDown('#stroke_linecap', '#linecap_opts', function() {
|
||||
var val = this.id.split('_')[1];
|
||||
svgCanvas.setStrokeAttr('stroke-linecap', val);
|
||||
operaRepaint();
|
||||
var icon = $.getSvgIcon(this.id).clone();
|
||||
$('#cur_linecap').empty().append(icon);
|
||||
$.resizeSvgIcons({'#cur_linecap .svg_icon': 20});
|
||||
}, true);
|
||||
|
||||
/*
|
||||
|
||||
When a flyout icon is selected
|
||||
|
||||
Reference in New Issue
Block a user