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);
|
||||
}
|
||||
|
||||
function gridUpdate () {
|
||||
if (showGrid) {
|
||||
updateGrid(svgCanvas.getZoom());
|
||||
}
|
||||
$('#canvasGrid').toggle(showGrid);
|
||||
$('#view_grid').toggleClass('push_button_pressed tool_button');
|
||||
}
|
||||
return {
|
||||
name: 'view_grid',
|
||||
svgicons: svgEditor.curConfig.extPath + 'grid-icon.xml',
|
||||
@@ -134,7 +141,11 @@ svgEditor.addExtension('view_grid', function() { 'use strict';
|
||||
zoomChanged: function(zoom) {
|
||||
if (showGrid) {updateGrid(zoom);}
|
||||
},
|
||||
|
||||
callback: function () {
|
||||
if (showGrid) {
|
||||
gridUpdate();
|
||||
}
|
||||
},
|
||||
buttons: [{
|
||||
id: 'view_grid',
|
||||
type: 'context',
|
||||
@@ -143,11 +154,7 @@ svgEditor.addExtension('view_grid', function() { 'use strict';
|
||||
events: {
|
||||
click: function() {
|
||||
svgEditor.curConfig.showGrid = showGrid = !showGrid;
|
||||
if (showGrid) {
|
||||
updateGrid(svgCanvas.getZoom());
|
||||
}
|
||||
$('#canvasGrid').toggle(showGrid);
|
||||
$('#view_grid').toggleClass('push_button_pressed tool_button');
|
||||
gridUpdate();
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
Reference in New Issue
Block a user