[PE] Fix custom bullets
This commit is contained in:
parent
962c7193ee
commit
affb23683a
|
@ -504,66 +504,46 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiBullets: function(v) {
|
onApiBullets: function(v) {
|
||||||
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.type !== v.get_ListType() || this._state.bullets.subtype !== v.get_ListSubType() || v.get_ListType()===0 && v.get_ListSubType()===0x1000) {
|
||||||
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),
|
var rec = this.toolbar.mnuMarkersPicker.store.at(8),
|
||||||
drawDefBullet = (rec.get('data').subtype===undefined) && (this._state.bullets.type===1 || this._state.bullets.subtype!==undefined);
|
drawDefBullet = (rec.get('data').subtype===0x1000) && (this._state.bullets.type===1 || this._state.bullets.subtype!==0x1000);
|
||||||
|
|
||||||
this._clearBullets();
|
this._clearBullets();
|
||||||
|
|
||||||
switch(this._state.bullets.type) {
|
switch(this._state.bullets.type) {
|
||||||
case 0:
|
case 0:
|
||||||
var idx;
|
var idx;
|
||||||
if (this._state.bullets.subtype!==undefined)
|
if (this._state.bullets.subtype!==0x1000)
|
||||||
idx = this._state.bullets.subtype;
|
idx = this._state.bullets.subtype;
|
||||||
else {
|
else { // custom
|
||||||
var me = this;
|
var me = this,
|
||||||
var selectedElements = me.api.getSelectedElements(),
|
bullet = v.asc_getListCustom();
|
||||||
props;
|
|
||||||
if (selectedElements && _.isArray(selectedElements)) {
|
|
||||||
for (var i = 0; i< selectedElements.length; i++) {
|
|
||||||
if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) {
|
|
||||||
props = selectedElements[i].get_ObjectValue();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (props) {
|
|
||||||
var bullet = props.asc_getBullet();
|
|
||||||
if (bullet) {
|
if (bullet) {
|
||||||
var type = bullet.asc_getType();
|
var type = bullet.asc_getType();
|
||||||
if (type == AscFormat.BULLET_TYPE_BULLET_CHAR) {
|
if (type == Asc.asc_PreviewBulletType.char) {
|
||||||
var symbol = bullet.asc_getSymbol();
|
var symbol = bullet.asc_getChar();
|
||||||
if (symbol) {
|
if (symbol) {
|
||||||
rec.get('data').subtype = undefined;
|
rec.get('data').subtype = 0x1000;
|
||||||
rec.set('tip', '');
|
rec.set('tip', '');
|
||||||
rec.set('drawdata', {type: Asc.asc_PreviewBulletType.char, char: symbol, specialFont: bullet.asc_getFont()});
|
rec.set('drawdata', {type: type, char: symbol, specialFont: bullet.asc_getSpecialFont()});
|
||||||
drawDefBullet = false;
|
drawDefBullet = false;
|
||||||
idx = 8;
|
idx = 8;
|
||||||
}
|
}
|
||||||
} else if (type == AscFormat.BULLET_TYPE_BULLET_BLIP) {
|
} else if (type == Asc.asc_PreviewBulletType.image) {
|
||||||
var id = bullet.asc_getImageId();
|
var id = bullet.asc_getImageId();
|
||||||
if (id) {
|
if (id) {
|
||||||
rec.get('data').subtype = undefined;
|
rec.get('data').subtype = 0x1000;
|
||||||
rec.set('tip', '');
|
rec.set('tip', '');
|
||||||
rec.set('drawdata', {type: Asc.asc_PreviewBulletType.image, imageId: id});
|
rec.set('drawdata', {type: type, imageId: id});
|
||||||
drawDefBullet = false;
|
drawDefBullet = false;
|
||||||
idx = 8;
|
idx = 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);
|
||||||
|
|
||||||
|
@ -603,7 +583,7 @@ define([
|
||||||
if (drawDefBullet) {
|
if (drawDefBullet) {
|
||||||
rec.get('data').subtype = 8;
|
rec.get('data').subtype = 8;
|
||||||
rec.set('tip', this.toolbar.tipMarkersDash);
|
rec.set('tip', this.toolbar.tipMarkersDash);
|
||||||
rec.set('drawdata', me.toolbar._markersArr[8]);
|
rec.set('drawdata', this.toolbar._markersArr[8]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1446,7 +1426,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.api){
|
if (this.api){
|
||||||
if (rawData.data.type===0 && rawData.data.subtype===undefined) {// custom bullet
|
if (rawData.data.type===0 && rawData.data.subtype===0x1000) {// custom bullet
|
||||||
var bullet = new Asc.asc_CBullet();
|
var bullet = new Asc.asc_CBullet();
|
||||||
if (rawData.drawdata.type===Asc.asc_PreviewBulletType.char) {
|
if (rawData.drawdata.type===Asc.asc_PreviewBulletType.char) {
|
||||||
bullet.asc_putSymbol(rawData.drawdata.char);
|
bullet.asc_putSymbol(rawData.drawdata.char);
|
||||||
|
|
Loading…
Reference in a new issue