[PE] Fix grid settings
This commit is contained in:
parent
ee1c093ac9
commit
cfb73f7cb4
|
@ -873,14 +873,6 @@ define([
|
||||||
Common.Utils.InternalSettings.set("pe-settings-showgrid", value);
|
Common.Utils.InternalSettings.set("pe-settings-showgrid", value);
|
||||||
me.api.asc_setShowGridlines(value);
|
me.api.asc_setShowGridlines(value);
|
||||||
|
|
||||||
value = Common.localStorage.getBool("pe-settings-snaptogrid");
|
|
||||||
Common.Utils.InternalSettings.set("pe-settings-snaptogrid", value);
|
|
||||||
me.api.asc_setSnapToGrid(value);
|
|
||||||
|
|
||||||
value = Common.localStorage.getItem("pe-settings-gridspacing");
|
|
||||||
Common.Utils.InternalSettings.set("pe-settings-gridspacing", value);
|
|
||||||
me.api.asc_setGridSpacing(value);
|
|
||||||
|
|
||||||
var application = me.getApplication();
|
var application = me.getApplication();
|
||||||
var toolbarController = application.getController('Toolbar'),
|
var toolbarController = application.getController('Toolbar'),
|
||||||
statusbarController = application.getController('Statusbar'),
|
statusbarController = application.getController('Statusbar'),
|
||||||
|
|
|
@ -273,13 +273,11 @@ define([
|
||||||
|
|
||||||
onGridlinesSnap: function(state) {
|
onGridlinesSnap: function(state) {
|
||||||
this.api.asc_setSnapToGrid(state);
|
this.api.asc_setSnapToGrid(state);
|
||||||
Common.localStorage.setBool('pe-settings-snaptogrid', state);
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
},
|
},
|
||||||
|
|
||||||
onGridlinesSpacing: function(value) {
|
onGridlinesSpacing: function(value) {
|
||||||
this.api.asc_setGridSpacing(value);
|
this.api.asc_setGridSpacing(value * 360000);
|
||||||
Common.localStorage.setItem('pe-settings-gridspacing', value);
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -291,7 +289,6 @@ define([
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
props = dlg.getSettings();
|
props = dlg.getSettings();
|
||||||
me.api.asc_setGridSpacing(props);
|
me.api.asc_setGridSpacing(props);
|
||||||
Common.localStorage.setItem('pe-settings-gridspacing', props);
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.view);
|
Common.NotificationCenter.trigger('edit:complete', me.view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,11 +302,11 @@ define([
|
||||||
this.view.btnGridlines.menu.items[0].setChecked(this.api.asc_getShowGridlines(), true);
|
this.view.btnGridlines.menu.items[0].setChecked(this.api.asc_getShowGridlines(), true);
|
||||||
this.view.btnGridlines.menu.items[1].setChecked(this.api.asc_getSnapToGrid(), true);
|
this.view.btnGridlines.menu.items[1].setChecked(this.api.asc_getSnapToGrid(), true);
|
||||||
|
|
||||||
var value = this.api.asc_getGridSpacing(),
|
var value = this.api.asc_getGridSpacing()/360000,
|
||||||
items = this.view.btnGridlines.menu.items;
|
items = this.view.btnGridlines.menu.items;
|
||||||
for (var i=3; i<14; i++) {
|
for (var i=3; i<14; i++) {
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
if (item.value<1 && Math.abs(item.value - value)<0.05)
|
if (item.value<1 && Math.abs(item.value - value)<0.005)
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
else if (item.value>=1 && Math.abs(item.value - value)<0.001)
|
else if (item.value>=1 && Math.abs(item.value - value)<0.001)
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
|
|
Loading…
Reference in a new issue