[PE] Draw custom bullets
This commit is contained in:
parent
65e574112b
commit
feb8ba0b56
|
@ -513,9 +513,53 @@ define([
|
|||
switch(this._state.bullets.type) {
|
||||
case 0:
|
||||
this.toolbar.btnMarkers.toggle(true, true);
|
||||
var idx,
|
||||
setDefault = true;
|
||||
if (this._state.bullets.subtype!==undefined)
|
||||
this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype, true);
|
||||
else
|
||||
idx = this._state.bullets.subtype;
|
||||
else {
|
||||
var selectedElements = this.api.getSelectedElements(),
|
||||
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) {
|
||||
var type = bullet.asc_getType();
|
||||
if (type == AscFormat.BULLET_TYPE_BULLET_CHAR) {
|
||||
var symbol = bullet.asc_getSymbol();
|
||||
if (symbol) {
|
||||
var rec = this.toolbar.mnuMarkersPicker.store.at(8);
|
||||
rec.get('data').subtype = undefined;
|
||||
rec.set('drawdata', {type: Asc.asc_PreviewBulletType.char, char: symbol, specialFont: bullet.asc_getFont()});
|
||||
setDefault = false;
|
||||
idx = 8;
|
||||
}
|
||||
} else if (type == AscFormat.BULLET_TYPE_BULLET_BLIP) {
|
||||
var id = bullet.asc_getImageId();
|
||||
if (id) {
|
||||
var rec = this.toolbar.mnuMarkersPicker.store.at(8);
|
||||
rec.get('data').subtype = undefined;
|
||||
rec.set('drawdata', {type: Asc.asc_PreviewBulletType.image, imageId: id});
|
||||
setDefault = false;
|
||||
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) :
|
||||
this.toolbar.mnuMarkersPicker.deselectAll(true);
|
||||
break;
|
||||
case 1:
|
||||
|
@ -1384,11 +1428,31 @@ define([
|
|||
}
|
||||
|
||||
if (btn) {
|
||||
btn.toggle(rawData.data.subtype > -1, true);
|
||||
btn.toggle(rawData.data.subtype !== -1, true);
|
||||
}
|
||||
|
||||
if (this.api)
|
||||
if (this.api){
|
||||
if (rawData.data.type===0 && rawData.data.subtype===undefined) {// custom bullet
|
||||
var bullet = new Asc.asc_CBullet();
|
||||
if (rawData.drawdata.type===Asc.asc_PreviewBulletType.char) {
|
||||
bullet.asc_putSymbol(rawData.drawdata.char);
|
||||
bullet.asc_putFont(rawData.drawdata.specialFont);
|
||||
} else if (rawData.drawdata.type===Asc.asc_PreviewBulletType.image)
|
||||
bullet.asc_fillBulletImage(rawData.drawdata.imageId);
|
||||
var selectedElements = me.api.getSelectedElements();
|
||||
if (selectedElements && _.isArray(selectedElements)) {
|
||||
for (var i = 0; i< selectedElements.length; i++) {
|
||||
if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) {
|
||||
var props = selectedElements[i].get_ObjectValue();
|
||||
props.asc_putBullet(bullet);
|
||||
this.api.paraApply(props);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
this.api.put_ListType(rawData.data.type, rawData.data.subtype);
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
Common.component.Analytics.trackEvent('ToolBar', 'List Type');
|
||||
|
|
|
@ -1458,6 +1458,17 @@ define([
|
|||
|
||||
// set dataviews
|
||||
|
||||
this._markersArr = [
|
||||
{type: Asc.asc_PreviewBulletType.text, text: 'None'},
|
||||
{type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00B7), specialFont: 'Symbol'},
|
||||
{type: Asc.asc_PreviewBulletType.char, char: 'o', specialFont: 'Courier New'},
|
||||
{type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A7), specialFont: 'Wingdings'},
|
||||
{type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x0076), specialFont: 'Wingdings'},
|
||||
{type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00D8), specialFont: 'Wingdings'},
|
||||
{type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00FC), specialFont: 'Wingdings'},
|
||||
{type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A8), specialFont: 'Symbol'},
|
||||
{type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x2013), specialFont: 'Arial'}
|
||||
];
|
||||
var _conf = this.mnuMarkersPicker.conf;
|
||||
this.mnuMarkersPicker = new Common.UI.DataView({
|
||||
el: $('#id-toolbar-menu-markers'),
|
||||
|
@ -1467,15 +1478,15 @@ define([
|
|||
allowScrollbar: false,
|
||||
delayRenderTips: true,
|
||||
store: new Common.UI.DataViewStore([
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1},drawdata: {type: Asc.asc_PreviewBulletType.text, text: 'None'}, skipRenderOnChange: true, tip: this.tipNone},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00B7),specialFont: 'Symbol'}, skipRenderOnChange: true, tip: this.tipMarkersFRound},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: 'o', specialFont: 'Courier New'}, skipRenderOnChange: true, tip: this.tipMarkersHRound},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A7), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersFSquare},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x0076), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersStar},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00D8), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersArrow},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00FC), specialFont: 'Wingdings'}, skipRenderOnChange: true, tip: this.tipMarkersCheckmark},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A8), specialFont: 'Symbol'}, skipRenderOnChange: true, tip: this.tipMarkersFRhombus},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x2013), specialFont: 'Arial'}, skipRenderOnChange: true, tip: this.tipMarkersDash}
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: -1},drawdata: this._markersArr[0], skipRenderOnChange: true, tip: this.tipNone},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 1}, drawdata: this._markersArr[1], skipRenderOnChange: true, tip: this.tipMarkersFRound},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 2}, drawdata: this._markersArr[2], skipRenderOnChange: true, tip: this.tipMarkersHRound},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 3}, drawdata: this._markersArr[3], skipRenderOnChange: true, tip: this.tipMarkersFSquare},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 4}, drawdata: this._markersArr[4], skipRenderOnChange: true, tip: this.tipMarkersStar},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 5}, drawdata: this._markersArr[5], skipRenderOnChange: true, tip: this.tipMarkersArrow},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 6}, drawdata: this._markersArr[6], skipRenderOnChange: true, tip: this.tipMarkersCheckmark},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 7}, drawdata: this._markersArr[7], skipRenderOnChange: true, tip: this.tipMarkersFRhombus},
|
||||
{id: 'id-markers-' + Common.UI.getId(), data: {type: 0, subtype: 8}, drawdata: this._markersArr[8], skipRenderOnChange: true, tip: this.tipMarkersDash}
|
||||
]),
|
||||
itemTemplate: _.template('<div id="<%= id %>" class="item-markerlist"></div>')
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue