[PE] Draw custom bullets in toolbar
This commit is contained in:
parent
feb8ba0b56
commit
962c7193ee
|
@ -504,21 +504,31 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiBullets: function(v) {
|
onApiBullets: function(v) {
|
||||||
if (this._state.bullets.type != v.get_ListType() || this._state.bullets.subtype != v.get_ListSubType()) {
|
if (this._state.bullets.type !== v.get_ListType() || this._state.bullets.subtype !== v.get_ListSubType() || v.get_ListType()===0 && v.get_ListSubType()===undefined || this._state.bullets.force) {
|
||||||
|
if (!this._state.bullets.force) {
|
||||||
|
var me = this;
|
||||||
|
this._state.bullets.force = true;
|
||||||
|
setTimeout(function(){
|
||||||
|
me.onApiBullets(v);
|
||||||
|
}, 100);
|
||||||
|
} else
|
||||||
|
this._state.bullets.force = false;
|
||||||
this._state.bullets.type = v.get_ListType();
|
this._state.bullets.type = v.get_ListType();
|
||||||
this._state.bullets.subtype = v.get_ListSubType();
|
this._state.bullets.subtype = v.get_ListSubType();
|
||||||
|
|
||||||
|
var rec = this.toolbar.mnuMarkersPicker.store.at(8),
|
||||||
|
drawDefBullet = (rec.get('data').subtype===undefined) && (this._state.bullets.type===1 || this._state.bullets.subtype!==undefined);
|
||||||
|
|
||||||
this._clearBullets();
|
this._clearBullets();
|
||||||
|
|
||||||
switch(this._state.bullets.type) {
|
switch(this._state.bullets.type) {
|
||||||
case 0:
|
case 0:
|
||||||
this.toolbar.btnMarkers.toggle(true, true);
|
var idx;
|
||||||
var idx,
|
|
||||||
setDefault = true;
|
|
||||||
if (this._state.bullets.subtype!==undefined)
|
if (this._state.bullets.subtype!==undefined)
|
||||||
idx = this._state.bullets.subtype;
|
idx = this._state.bullets.subtype;
|
||||||
else {
|
else {
|
||||||
var selectedElements = this.api.getSelectedElements(),
|
var me = this;
|
||||||
|
var selectedElements = me.api.getSelectedElements(),
|
||||||
props;
|
props;
|
||||||
if (selectedElements && _.isArray(selectedElements)) {
|
if (selectedElements && _.isArray(selectedElements)) {
|
||||||
for (var i = 0; i< selectedElements.length; i++) {
|
for (var i = 0; i< selectedElements.length; i++) {
|
||||||
|
@ -535,32 +545,30 @@ define([
|
||||||
if (type == AscFormat.BULLET_TYPE_BULLET_CHAR) {
|
if (type == AscFormat.BULLET_TYPE_BULLET_CHAR) {
|
||||||
var symbol = bullet.asc_getSymbol();
|
var symbol = bullet.asc_getSymbol();
|
||||||
if (symbol) {
|
if (symbol) {
|
||||||
var rec = this.toolbar.mnuMarkersPicker.store.at(8);
|
|
||||||
rec.get('data').subtype = undefined;
|
rec.get('data').subtype = undefined;
|
||||||
|
rec.set('tip', '');
|
||||||
rec.set('drawdata', {type: Asc.asc_PreviewBulletType.char, char: symbol, specialFont: bullet.asc_getFont()});
|
rec.set('drawdata', {type: Asc.asc_PreviewBulletType.char, char: symbol, specialFont: bullet.asc_getFont()});
|
||||||
setDefault = false;
|
drawDefBullet = false;
|
||||||
idx = 8;
|
idx = 8;
|
||||||
}
|
}
|
||||||
} else if (type == AscFormat.BULLET_TYPE_BULLET_BLIP) {
|
} else if (type == AscFormat.BULLET_TYPE_BULLET_BLIP) {
|
||||||
var id = bullet.asc_getImageId();
|
var id = bullet.asc_getImageId();
|
||||||
if (id) {
|
if (id) {
|
||||||
var rec = this.toolbar.mnuMarkersPicker.store.at(8);
|
|
||||||
rec.get('data').subtype = undefined;
|
rec.get('data').subtype = undefined;
|
||||||
|
rec.set('tip', '');
|
||||||
rec.set('drawdata', {type: Asc.asc_PreviewBulletType.image, imageId: id});
|
rec.set('drawdata', {type: Asc.asc_PreviewBulletType.image, imageId: id});
|
||||||
setDefault = false;
|
drawDefBullet = false;
|
||||||
idx = 8;
|
idx = 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (setDefault) {
|
|
||||||
var rec = this.toolbar.mnuMarkersPicker.store.at(8);
|
|
||||||
rec.get('data').subtype = 8;
|
|
||||||
rec.set('drawdata', this.toolbar._markersArr[8]);
|
|
||||||
}
|
|
||||||
(idx!==undefined) ? this.toolbar.mnuMarkersPicker.selectByIndex(idx, true) :
|
(idx!==undefined) ? this.toolbar.mnuMarkersPicker.selectByIndex(idx, true) :
|
||||||
this.toolbar.mnuMarkersPicker.deselectAll(true);
|
this.toolbar.mnuMarkersPicker.deselectAll(true);
|
||||||
|
|
||||||
|
this.toolbar.btnMarkers.toggle(true, true);
|
||||||
|
this.toolbar.mnuNumbersPicker.deselectAll(true);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
var idx = 0;
|
var idx = 0;
|
||||||
|
@ -589,8 +597,14 @@ define([
|
||||||
}
|
}
|
||||||
this.toolbar.btnNumbers.toggle(true, true);
|
this.toolbar.btnNumbers.toggle(true, true);
|
||||||
this.toolbar.mnuNumbersPicker.selectByIndex(idx, true);
|
this.toolbar.mnuNumbersPicker.selectByIndex(idx, true);
|
||||||
|
this.toolbar.mnuMarkersPicker.deselectAll(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (drawDefBullet) {
|
||||||
|
rec.get('data').subtype = 8;
|
||||||
|
rec.set('tip', this.toolbar.tipMarkersDash);
|
||||||
|
rec.set('drawdata', me.toolbar._markersArr[8]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1439,7 +1453,7 @@ define([
|
||||||
bullet.asc_putFont(rawData.drawdata.specialFont);
|
bullet.asc_putFont(rawData.drawdata.specialFont);
|
||||||
} else if (rawData.drawdata.type===Asc.asc_PreviewBulletType.image)
|
} else if (rawData.drawdata.type===Asc.asc_PreviewBulletType.image)
|
||||||
bullet.asc_fillBulletImage(rawData.drawdata.imageId);
|
bullet.asc_fillBulletImage(rawData.drawdata.imageId);
|
||||||
var selectedElements = me.api.getSelectedElements();
|
var selectedElements = this.api.getSelectedElements();
|
||||||
if (selectedElements && _.isArray(selectedElements)) {
|
if (selectedElements && _.isArray(selectedElements)) {
|
||||||
for (var i = 0; i< selectedElements.length; i++) {
|
for (var i = 0; i< selectedElements.length; i++) {
|
||||||
if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) {
|
if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) {
|
||||||
|
|
Loading…
Reference in a new issue