Properly allow for ext-grid showGrid default setting
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2805 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -127,6 +127,13 @@ svgEditor.addExtension('view_grid', function() { 'use strict';
|
|||||||
svgCanvas.setHref(gridimg, datauri);
|
svgCanvas.setHref(gridimg, datauri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gridUpdate () {
|
||||||
|
if (showGrid) {
|
||||||
|
updateGrid(svgCanvas.getZoom());
|
||||||
|
}
|
||||||
|
$('#canvasGrid').toggle(showGrid);
|
||||||
|
$('#view_grid').toggleClass('push_button_pressed tool_button');
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
name: 'view_grid',
|
name: 'view_grid',
|
||||||
svgicons: svgEditor.curConfig.extPath + 'grid-icon.xml',
|
svgicons: svgEditor.curConfig.extPath + 'grid-icon.xml',
|
||||||
@@ -134,7 +141,11 @@ svgEditor.addExtension('view_grid', function() { 'use strict';
|
|||||||
zoomChanged: function(zoom) {
|
zoomChanged: function(zoom) {
|
||||||
if (showGrid) {updateGrid(zoom);}
|
if (showGrid) {updateGrid(zoom);}
|
||||||
},
|
},
|
||||||
|
callback: function () {
|
||||||
|
if (showGrid) {
|
||||||
|
gridUpdate();
|
||||||
|
}
|
||||||
|
},
|
||||||
buttons: [{
|
buttons: [{
|
||||||
id: 'view_grid',
|
id: 'view_grid',
|
||||||
type: 'context',
|
type: 'context',
|
||||||
@@ -143,11 +154,7 @@ svgEditor.addExtension('view_grid', function() { 'use strict';
|
|||||||
events: {
|
events: {
|
||||||
click: function() {
|
click: function() {
|
||||||
svgEditor.curConfig.showGrid = showGrid = !showGrid;
|
svgEditor.curConfig.showGrid = showGrid = !showGrid;
|
||||||
if (showGrid) {
|
gridUpdate();
|
||||||
updateGrid(svgCanvas.getZoom());
|
|
||||||
}
|
|
||||||
$('#canvasGrid').toggle(showGrid);
|
|
||||||
$('#view_grid').toggleClass('push_button_pressed tool_button');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|||||||
@@ -2553,10 +2553,10 @@ TODOS
|
|||||||
html = '<label' + cont_id + '>'
|
html = '<label' + cont_id + '>'
|
||||||
+ '<select id="' + tool.id + '">';
|
+ '<select id="' + tool.id + '">';
|
||||||
$.each(tool.options, function(val, text) {
|
$.each(tool.options, function(val, text) {
|
||||||
var sel = (val == tool.defval) ? " selected":"";
|
var sel = (val == tool.defval) ? ' selected' : '';
|
||||||
html += '<option value="'+val+'"' + sel + '>' + text + '</option>';
|
html += '<option value="'+val+'"' + sel + '>' + text + '</option>';
|
||||||
});
|
});
|
||||||
html += "</select></label>";
|
html += '</select></label>';
|
||||||
// Creates the tool, hides & adds it, returns the select element
|
// Creates the tool, hides & adds it, returns the select element
|
||||||
var sel = $(html).appendTo(panel).find('select');
|
var sel = $(html).appendTo(panel).find('select');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user