mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-26 09:45:08 +08:00
Merge pull request 'feature/pdf-annot-opacity' (#200) from feature/pdf-annot-opacity into release/v8.3.0
Fix Bug 64261
This commit is contained in:
@ -72,6 +72,7 @@ define([
|
||||
(this.options.effects!==undefined) && (config['effects'] = this.options.effects);
|
||||
(this.options.colorHints!==undefined) && (config['colorHints'] = this.options.colorHints);
|
||||
(this.options.paletteCls!==undefined) && (config['cls'] = this.options.paletteCls);
|
||||
(this.options.storageSuffix!==undefined) && (config['storageSuffix'] = this.options.storageSuffix);
|
||||
|
||||
this.colorPicker = new Common.UI.ThemeColorPalette(config);
|
||||
this.colorPicker.on('select', _.bind(this.onColorSelect, this));
|
||||
@ -124,9 +125,8 @@ define([
|
||||
cls: 'color-menu ' + (options.eyeDropper ? 'shifted-right' : 'shifted-left'),
|
||||
additionalAlign: options.additionalAlign,
|
||||
items: (options.additionalItemsBefore ? options.additionalItemsBefore : []).concat(auto).concat([
|
||||
{ template: _.template('<div id="' + id + '-color-menu" style="width: ' + width + '; height:' + height + '; display: inline-block;"></div>') },
|
||||
{caption: '--'}
|
||||
]).concat(eyedropper).concat([
|
||||
{ template: _.template('<div id="' + id + '-color-menu" style="width: ' + width + '; height:' + height + '; display: inline-block;"></div>') }
|
||||
]).concat(options.hideColorsSeparator ? [] : {caption: '--'}).concat(eyedropper).concat([
|
||||
{
|
||||
id: id + '-color-new',
|
||||
template: _.template('<a tabindex="-1" type="menuitem" style="">' + this.textNewColor + '</a>')
|
||||
|
||||
@ -99,6 +99,11 @@ define(['gateway'], function () {
|
||||
return (value!==null) ? (parseInt(value) != 0) : defValue;
|
||||
};
|
||||
|
||||
var _getItemAsInt = function (name, defValue) {
|
||||
var value = _getItem(name);
|
||||
return (value!==null) ? parseInt(value) : defValue || 0;
|
||||
};
|
||||
|
||||
var _getItemExists = function (name) {
|
||||
var value = _getItem(name);
|
||||
return value !== null;
|
||||
@ -125,6 +130,7 @@ define(['gateway'], function () {
|
||||
_storeName = name;
|
||||
},
|
||||
getItem: _getItem,
|
||||
getItemAsInt: _getItemAsInt,
|
||||
getBool: _getItemAsBool,
|
||||
setBool: _setItemAsBool,
|
||||
setItem: _setItem,
|
||||
|
||||
@ -869,6 +869,8 @@ define([], function () {
|
||||
documentHolder.btnAddAnnotComment.on('click', _.bind(this.addComment, this, {isFromSelBar: true}));
|
||||
documentHolder.mnuStrokeHighlightColorPicker.on('select', _.bind(this.onSelectStrokeColor, this, documentHolder.btnStrokeHighlightColor));
|
||||
documentHolder.mnuStrokeColorPicker.on('select', _.bind(this.onSelectStrokeColor, this, documentHolder.btnStrokeColor));
|
||||
documentHolder.btnStrokeColor.menu.on('show:after', _.bind(this.onStrokeShowAfter, this));
|
||||
documentHolder.btnStrokeHighlightColor.menu.on('show:after', _.bind(this.onStrokeShowAfter, this));
|
||||
this.api.UpdateInterfaceState();
|
||||
}
|
||||
|
||||
@ -2492,6 +2494,39 @@ define([], function () {
|
||||
this.api.asc_SetStrokeColor(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
};
|
||||
|
||||
dh.onSetStrokeOpacity = function(sizePicker, direction) {
|
||||
var val = this.api.asc_GetOpacity();
|
||||
if (direction === 'up') {
|
||||
if (val % 10 > 0.1) {
|
||||
val = Math.ceil(val / 10) * 10;
|
||||
} else {
|
||||
val += 10;
|
||||
}
|
||||
val = Math.min(100, val);
|
||||
} else {
|
||||
if (val % 10 > 0.1) {
|
||||
val = Math.floor(val / 10) * 10;
|
||||
} else {
|
||||
val -= 10
|
||||
}
|
||||
val = Math.max(0, val);
|
||||
}
|
||||
sizePicker.setValue(val + '%');
|
||||
this.api.asc_SetOpacity(val);
|
||||
};
|
||||
|
||||
dh.onStrokeShowAfter = function(menu) {
|
||||
if (!menu.sizePicker) {
|
||||
menu.sizePicker = new Common.UI.UpDownPicker({
|
||||
el: menu.cmpEl.find('.custom-scale'),
|
||||
caption: this.documentHolder.txtOpacity,
|
||||
minWidth: 40
|
||||
});
|
||||
menu.sizePicker.on('click', _.bind(this.onSetStrokeOpacity, this, menu.sizePicker));
|
||||
}
|
||||
menu.sizePicker.setValue(this.api.asc_GetOpacity() + '%');
|
||||
};
|
||||
|
||||
dh.applySettings = function() {
|
||||
!Common.Utils.InternalSettings.get('pdfe-settings-annot-bar') && this.onHideAnnotBar();
|
||||
};
|
||||
|
||||
@ -258,23 +258,27 @@ define([
|
||||
|
||||
},
|
||||
|
||||
onCreateAnnotBar: function(btnStrikeout, mnuStrikeoutColorPicker, btnUnderline, mnuUnderlineColorPicker, btnHighlight, mnuHighlightColorPicker) {
|
||||
onCreateAnnotBar: function(btnStrikeout, btnUnderline, btnHighlight) {
|
||||
var toolbar = this.toolbar;
|
||||
btnStrikeout.currentColor = toolbar.btnStrikeout.currentColor;
|
||||
btnStrikeout.setColor(btnStrikeout.currentColor);
|
||||
btnStrikeout.toggle(toolbar.btnStrikeout.pressed, true);
|
||||
|
||||
toolbar.btnsStrikeout.push(btnStrikeout);
|
||||
btnStrikeout.toggle(toolbar.btnStrikeout.pressed, true);
|
||||
btnStrikeout.setColor(toolbar.btnStrikeout.currentColor);
|
||||
var mnuStrikeoutColorPicker = toolbar.createPen(btnStrikeout, 'strikeout', true);
|
||||
toolbar.mnusStrikeoutColorPicker.push(mnuStrikeoutColorPicker);
|
||||
btnUnderline.currentColor = toolbar.btnUnderline.currentColor;
|
||||
btnUnderline.setColor(btnUnderline.currentColor);
|
||||
btnUnderline.toggle(toolbar.btnUnderline.pressed, true);
|
||||
|
||||
toolbar.btnsUnderline.push(btnUnderline);
|
||||
btnUnderline.toggle(toolbar.btnUnderline.pressed, true);
|
||||
btnUnderline.setColor(toolbar.btnUnderline.currentColor);
|
||||
var mnuUnderlineColorPicker = toolbar.createPen(btnUnderline, 'underline', true);
|
||||
toolbar.mnusUnderlineColorPicker.push(mnuUnderlineColorPicker);
|
||||
btnHighlight.currentColor = toolbar.btnHighlight.currentColor;
|
||||
btnHighlight.setColor(btnHighlight.currentColor);
|
||||
btnHighlight.toggle(toolbar.btnHighlight.pressed, true);
|
||||
|
||||
toolbar.btnsHighlight.push(btnHighlight);
|
||||
btnHighlight.toggle(toolbar.btnHighlight.pressed, true);
|
||||
btnHighlight.setColor(toolbar.btnHighlight.currentColor);
|
||||
var mnuHighlightColorPicker = toolbar.createPen(btnHighlight, 'highlight', true);
|
||||
toolbar.mnusHighlightColorPicker.push(mnuHighlightColorPicker);
|
||||
|
||||
btnStrikeout.on('click', _.bind(this.onBtnStrikeout, this));
|
||||
mnuStrikeoutColorPicker.on('select', _.bind(this.onSelectStrikeoutColor, this));
|
||||
btnUnderline.on('click', _.bind(this.onBtnUnderline, this));
|
||||
@ -937,7 +941,7 @@ define([
|
||||
var r = strcolor[0] + strcolor[1],
|
||||
g = strcolor[2] + strcolor[3],
|
||||
b = strcolor[4] + strcolor[5];
|
||||
me.api.SetMarkerFormat(me.toolbar.btnStrikeout.options.type, true, 100, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
me.api.SetMarkerFormat(me.toolbar.btnStrikeout.options.type, true, Common.Utils.InternalSettings.get("pdfe-annot-opacity-strikeout") , parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
// me.toolbar.mnuStrikeoutTransparent.setChecked(false, true);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnStrikeout);
|
||||
@ -997,7 +1001,7 @@ define([
|
||||
var r = strcolor[0] + strcolor[1],
|
||||
g = strcolor[2] + strcolor[3],
|
||||
b = strcolor[4] + strcolor[5];
|
||||
me.api.SetMarkerFormat(me.toolbar.btnUnderline.options.type, true, 100, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
me.api.SetMarkerFormat(me.toolbar.btnUnderline.options.type, true, Common.Utils.InternalSettings.get("pdfe-annot-opacity-underline"), parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
// me.toolbar.mnuUnderlineTransparent.setChecked(false, true);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnUnderline);
|
||||
@ -1057,7 +1061,7 @@ define([
|
||||
var r = strcolor[0] + strcolor[1],
|
||||
g = strcolor[2] + strcolor[3],
|
||||
b = strcolor[4] + strcolor[5];
|
||||
me.api.SetMarkerFormat(me.toolbar.btnHighlight.options.type, true, 100, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
me.api.SetMarkerFormat(me.toolbar.btnHighlight.options.type, true, Common.Utils.InternalSettings.get("pdfe-annot-opacity-highlight"), parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
// me.toolbar.mnuHighlightTransparent.setChecked(false, true);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnHighlight);
|
||||
|
||||
@ -1491,6 +1491,13 @@ define([], function () {
|
||||
colorLine: false,
|
||||
colors: config.colors,
|
||||
color: '3D8A44',
|
||||
additionalItemsAfter: [
|
||||
{caption: '--'},
|
||||
new Common.UI.MenuItem({
|
||||
template: _.template('<div class="custom-scale" data-stopPropagation="true"></div>'),
|
||||
stopPropagation: true
|
||||
})
|
||||
],
|
||||
dynamiccolors: config.dynamiccolors,
|
||||
themecolors: config.themecolors,
|
||||
effects: config.effects,
|
||||
@ -1498,13 +1505,11 @@ define([], function () {
|
||||
paletteCls: config.cls,
|
||||
paletteWidth: config.paletteWidth,
|
||||
storageSuffix: '-draw',
|
||||
hideColorsSeparator: true,
|
||||
hint: toolbar.textUnderline,
|
||||
type: AscPDF.ANNOTATIONS_TYPES.Underline
|
||||
});
|
||||
annotBarBtns.push(this.btnUnderline);
|
||||
this.btnUnderline.setMenu();
|
||||
this.mnuUnderlineColorPicker = this.btnUnderline.getPicker();
|
||||
this.btnUnderline.currentColor = this.btnUnderline.color;
|
||||
|
||||
this.btnStrikeout = new Common.UI.ButtonColored({
|
||||
parentEl: $('#annot-bar-strikeout', container),
|
||||
@ -1517,6 +1522,13 @@ define([], function () {
|
||||
colorLine: false,
|
||||
colors: config.colors,
|
||||
color: 'D43230',
|
||||
additionalItemsAfter: [
|
||||
{caption: '--'},
|
||||
new Common.UI.MenuItem({
|
||||
template: _.template('<div class="custom-scale" data-stopPropagation="true"></div>'),
|
||||
stopPropagation: true
|
||||
})
|
||||
],
|
||||
dynamiccolors: config.dynamiccolors,
|
||||
themecolors: config.themecolors,
|
||||
effects: config.effects,
|
||||
@ -1524,13 +1536,11 @@ define([], function () {
|
||||
paletteCls: config.cls,
|
||||
paletteWidth: config.paletteWidth,
|
||||
storageSuffix: '-draw',
|
||||
hideColorsSeparator: true,
|
||||
hint: toolbar.textStrikeout,
|
||||
type: AscPDF.ANNOTATIONS_TYPES.Strikeout
|
||||
});
|
||||
annotBarBtns.push(this.btnStrikeout);
|
||||
this.btnStrikeout.setMenu();
|
||||
this.mnuStrikeoutColorPicker = this.btnStrikeout.getPicker();
|
||||
this.btnStrikeout.currentColor = this.btnStrikeout.color;
|
||||
|
||||
this.btnHighlight = new Common.UI.ButtonColored({
|
||||
parentEl: $('#annot-bar-highlight', container),
|
||||
@ -1540,6 +1550,13 @@ define([], function () {
|
||||
allowDepress: true,
|
||||
split: true,
|
||||
menu: true,
|
||||
additionalItemsAfter: [
|
||||
{caption: '--'},
|
||||
new Common.UI.MenuItem({
|
||||
template: _.template('<div class="custom-scale" data-stopPropagation="true"></div>'),
|
||||
stopPropagation: true
|
||||
})
|
||||
],
|
||||
colors: [
|
||||
'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18',
|
||||
'249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000'
|
||||
@ -1552,13 +1569,11 @@ define([], function () {
|
||||
paletteCls: config.cls,
|
||||
paletteWidth: config.paletteWidth,
|
||||
storageSuffix: '-draw',
|
||||
hideColorsSeparator: true,
|
||||
hint: toolbar.textHighlight,
|
||||
type: AscPDF.ANNOTATIONS_TYPES.Highlight
|
||||
});
|
||||
annotBarBtns.push(this.btnHighlight);
|
||||
this.btnHighlight.setMenu();
|
||||
this.mnuHighlightColorPicker = this.btnHighlight.getPicker();
|
||||
this.btnHighlight.currentColor = this.btnHighlight.color;
|
||||
|
||||
this.btnEditText = new Common.UI.Button({
|
||||
parentEl: $('#annot-bar-edit-text', container),
|
||||
@ -1568,7 +1583,7 @@ define([], function () {
|
||||
hint: this.tipRecognize
|
||||
});
|
||||
annotBarBtns.push(this.btnEditText);
|
||||
this.fireEvent('annotbar:create', [this.btnStrikeout, this.mnuStrikeoutColorPicker, this.btnUnderline, this.mnuUnderlineColorPicker, this.btnHighlight, this.mnuHighlightColorPicker]);
|
||||
this.fireEvent('annotbar:create', [this.btnStrikeout, this.btnUnderline, this.btnHighlight]);
|
||||
|
||||
return container;
|
||||
};
|
||||
@ -1612,6 +1627,13 @@ define([], function () {
|
||||
'249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000'
|
||||
],
|
||||
color: 'FFFC54',
|
||||
additionalItemsAfter: [
|
||||
{caption: '--'},
|
||||
new Common.UI.MenuItem({
|
||||
template: _.template('<div class="custom-scale" data-stopPropagation="true"></div>'),
|
||||
stopPropagation: true
|
||||
})
|
||||
],
|
||||
dynamiccolors: config.dynamiccolors,
|
||||
themecolors: config.themecolors,
|
||||
effects: config.effects,
|
||||
@ -1619,6 +1641,7 @@ define([], function () {
|
||||
paletteCls: config.cls,
|
||||
paletteWidth: config.paletteWidth,
|
||||
storageSuffix: '-draw',
|
||||
hideColorsSeparator: true,
|
||||
hint: this.textColor
|
||||
});
|
||||
annotSelectBarBtns.push(this.btnStrokeHighlightColor);
|
||||
@ -1634,6 +1657,13 @@ define([], function () {
|
||||
colorLine: 'box',
|
||||
colors: config.colors,
|
||||
color: '3D8A44',
|
||||
additionalItemsAfter: [
|
||||
{caption: '--'},
|
||||
new Common.UI.MenuItem({
|
||||
template: _.template('<div class="custom-scale" data-stopPropagation="true"></div>'),
|
||||
stopPropagation: true
|
||||
})
|
||||
],
|
||||
dynamiccolors: config.dynamiccolors,
|
||||
themecolors: config.themecolors,
|
||||
effects: config.effects,
|
||||
@ -1641,6 +1671,7 @@ define([], function () {
|
||||
paletteCls: config.cls,
|
||||
paletteWidth: config.paletteWidth,
|
||||
storageSuffix: '-draw',
|
||||
hideColorsSeparator: true,
|
||||
hint: this.textColor
|
||||
});
|
||||
annotSelectBarBtns.push(this.btnStrokeColor);
|
||||
|
||||
@ -318,6 +318,7 @@ define([
|
||||
this.paragraphControls.push(this.btnTextHighlightColor);
|
||||
arr.push(this.btnTextHighlightColor);
|
||||
|
||||
var colorsconfig = Common.UI.simpleColorsConfig;
|
||||
this.btnFontColor = new Common.UI.ButtonColored({
|
||||
id: 'id-toolbar-btn-fontcolor',
|
||||
cls: 'btn-toolbar',
|
||||
@ -325,11 +326,17 @@ define([
|
||||
lock: [_set.paragraphLock, _set.lostConnect, _set.noTextSelected, _set.shapeLock, _set.disableOnStart],
|
||||
split: true,
|
||||
menu: true,
|
||||
eyeDropper: true,
|
||||
colors: colorsconfig.colors,
|
||||
color: '000000',
|
||||
dynamiccolors: colorsconfig.dynamiccolors,
|
||||
themecolors: colorsconfig.themecolors,
|
||||
effects: colorsconfig.effects,
|
||||
columns: colorsconfig.columns,
|
||||
paletteCls: colorsconfig.cls,
|
||||
paletteWidth: colorsconfig.paletteWidth,
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: '0, -16',
|
||||
penOptions: {color: '000000'}
|
||||
dataHintOffset: '0, -16'
|
||||
});
|
||||
this.paragraphControls.push(this.btnFontColor);
|
||||
arr.push(this.btnFontColor);
|
||||
@ -882,6 +889,7 @@ define([
|
||||
});
|
||||
this.toolbarControls.push(this.chShowComments);
|
||||
|
||||
var colorsconfig = Common.UI.simpleColorsConfig;
|
||||
this.btnStrikeout = new Common.UI.ButtonColored({
|
||||
id: 'id-toolbar-btn-strikeout',
|
||||
cls: 'btn-toolbar',
|
||||
@ -892,10 +900,26 @@ define([
|
||||
split: true,
|
||||
menu: true,
|
||||
colorLine: false,
|
||||
additionalItemsAfter: [
|
||||
{caption: '--'},
|
||||
new Common.UI.MenuItem({
|
||||
template: _.template('<div class="custom-scale" data-stopPropagation="true"></div>'),
|
||||
stopPropagation: true
|
||||
})
|
||||
],
|
||||
colors: colorsconfig.colors,
|
||||
color: 'D43230',
|
||||
dynamiccolors: colorsconfig.dynamiccolors,
|
||||
themecolors: colorsconfig.themecolors,
|
||||
effects: colorsconfig.effects,
|
||||
columns: colorsconfig.columns,
|
||||
paletteCls: colorsconfig.cls,
|
||||
paletteWidth: colorsconfig.paletteWidth,
|
||||
storageSuffix: '-draw',
|
||||
hideColorsSeparator: true,
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'top',
|
||||
dataHintOffset: '0, -16',
|
||||
penOptions: {color: 'D43230'},
|
||||
type: AscPDF.ANNOTATIONS_TYPES.Strikeout
|
||||
});
|
||||
this.btnsStrikeout = [this.btnStrikeout];
|
||||
@ -910,10 +934,26 @@ define([
|
||||
split: true,
|
||||
menu: true,
|
||||
colorLine: false,
|
||||
additionalItemsAfter: [
|
||||
{caption: '--'},
|
||||
new Common.UI.MenuItem({
|
||||
template: _.template('<div class="custom-scale" data-stopPropagation="true"></div>'),
|
||||
stopPropagation: true
|
||||
})
|
||||
],
|
||||
colors: colorsconfig.colors,
|
||||
color: '3D8A44',
|
||||
dynamiccolors: colorsconfig.dynamiccolors,
|
||||
themecolors: colorsconfig.themecolors,
|
||||
effects: colorsconfig.effects,
|
||||
columns: colorsconfig.columns,
|
||||
paletteCls: colorsconfig.cls,
|
||||
paletteWidth: colorsconfig.paletteWidth,
|
||||
storageSuffix: '-draw',
|
||||
hideColorsSeparator: true,
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: '0, -16',
|
||||
penOptions: {color: '3D8A44'},
|
||||
type: AscPDF.ANNOTATIONS_TYPES.Underline
|
||||
});
|
||||
this.btnsUnderline = [this.btnUnderline];
|
||||
@ -927,14 +967,30 @@ define([
|
||||
allowDepress: true,
|
||||
split: true,
|
||||
menu: true,
|
||||
additionalItemsAfter: [
|
||||
{caption: '--'},
|
||||
new Common.UI.MenuItem({
|
||||
template: _.template('<div class="custom-scale" data-stopPropagation="true"></div>'),
|
||||
stopPropagation: true
|
||||
})
|
||||
],
|
||||
colors: [
|
||||
'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18',
|
||||
'249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000'
|
||||
],
|
||||
color: 'FFFC54',
|
||||
dynamiccolors: colorsconfig.dynamiccolors,
|
||||
themecolors: colorsconfig.themecolors,
|
||||
effects: colorsconfig.effects,
|
||||
columns: colorsconfig.columns,
|
||||
paletteCls: colorsconfig.cls,
|
||||
paletteWidth: colorsconfig.paletteWidth,
|
||||
storageSuffix: '-draw',
|
||||
hideColorsSeparator: true,
|
||||
type: AscPDF.ANNOTATIONS_TYPES.Highlight,
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'top',
|
||||
dataHintOffset: '0, -16',
|
||||
penOptions: {color: 'FFFC54', colors: [
|
||||
'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18',
|
||||
'249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000'
|
||||
]}
|
||||
dataHintOffset: '0, -16'
|
||||
});
|
||||
this.btnsHighlight = [this.btnHighlight];
|
||||
|
||||
@ -1383,49 +1439,61 @@ define([
|
||||
return $host;
|
||||
},
|
||||
|
||||
createPen: function(button, id, transparent, storage) {
|
||||
var mnu;
|
||||
button.setMenu(new Common.UI.Menu({
|
||||
cls: 'shifted-left',
|
||||
style: 'min-width: 100px;',
|
||||
items: [
|
||||
{template: _.template('<div id="id-toolbar-menu-' + id + '" style="width: 174px; display: inline-block;"></div>')},
|
||||
{caption: '--'},
|
||||
{
|
||||
id: 'id-toolbar-menu-' + id + '-color-new',
|
||||
template: _.template('<a tabindex="-1" type="menuitem" style="">' + button.textNewColor + '</a>')
|
||||
},
|
||||
{caption: '--', visible: !!transparent},
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption: this.strMenuNoFill,
|
||||
checkable: true,
|
||||
visible: !!transparent,
|
||||
style: 'padding-left:20px;padding-right:20px;'
|
||||
})
|
||||
]
|
||||
}), true);
|
||||
button.currentColor = button.options.penOptions.color;
|
||||
button.setColor(button.currentColor);
|
||||
var config = Common.UI.simpleColorsConfig;
|
||||
var picker = new Common.UI.ThemeColorPalette({
|
||||
el: $('#id-toolbar-menu-' + id),
|
||||
colors: button.options.penOptions.colors || config.colors,
|
||||
value: button.currentColor,
|
||||
dynamiccolors: config.dynamiccolors,
|
||||
themecolors: config.themecolors,
|
||||
effects: config.effects,
|
||||
columns: config.columns,
|
||||
cls: config.cls,
|
||||
outerMenu: {menu: button.menu, index: 0, focusOnShow: true},
|
||||
storageSuffix: storage || ''
|
||||
createPen: function(button, id, opacity) {
|
||||
var me = this;
|
||||
button.setMenu();
|
||||
button.currentColor = button.color;
|
||||
if (opacity) {
|
||||
var onShowAfter = function(menu) {
|
||||
if (menu.sizePicker) {
|
||||
menu.sizePicker.setValue(Common.Utils.InternalSettings.get("pdfe-annot-opacity-" + id) + '%');
|
||||
} else {
|
||||
menu.sizePicker = me.createOpacityPicker(button, id, menu.cmpEl.find('.custom-scale'));
|
||||
}
|
||||
};
|
||||
button.menu.on('show:after', onShowAfter);
|
||||
}
|
||||
|
||||
return button.getPicker();
|
||||
},
|
||||
|
||||
createOpacityPicker: function(button, id, el) {
|
||||
var me = this;
|
||||
var sizePicker = new Common.UI.UpDownPicker({
|
||||
el: el,
|
||||
caption: this.txtOpacity,
|
||||
minWidth: 40
|
||||
});
|
||||
button.setPicker(picker);
|
||||
picker.on('select', _.bind(button.onColorSelect, button));
|
||||
button.menu.setInnerMenu([{menu: picker, index: 0}]);
|
||||
button.menu.cmpEl.find('#id-toolbar-menu-' + id + '-color-new').on('click', function() {
|
||||
picker.addNewColor(button.currentColor);
|
||||
sizePicker.on('click', function (direction) {
|
||||
var val = Common.Utils.InternalSettings.get("pdfe-annot-opacity-" + id);
|
||||
if (direction === 'up') {
|
||||
if (val % 10 > 0.1) {
|
||||
val = Math.ceil(val / 10) * 10;
|
||||
} else {
|
||||
val += 10;
|
||||
}
|
||||
val = Math.min(100, val);
|
||||
} else {
|
||||
if (val % 10 > 0.1) {
|
||||
val = Math.floor(val / 10) * 10;
|
||||
} else {
|
||||
val -= 10
|
||||
}
|
||||
val = Math.max(0, val);
|
||||
}
|
||||
this.setValue(val + '%');
|
||||
Common.Utils.InternalSettings.set("pdfe-annot-opacity-" + id, val);
|
||||
Common.localStorage.setItem("pdfe-annot-opacity-" + id, val);
|
||||
if (button.pressed) {
|
||||
var strcolor = button.currentColor || '0000FF',
|
||||
r = strcolor[0] + strcolor[1],
|
||||
g = strcolor[2] + strcolor[3],
|
||||
b = strcolor[4] + strcolor[5];
|
||||
me.api && me.api.SetMarkerFormat(button.options.type, true, val, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
}
|
||||
});
|
||||
return [picker, mnu];
|
||||
sizePicker.setValue(Common.Utils.InternalSettings.get("pdfe-annot-opacity-" + id) + '%');
|
||||
return sizePicker;
|
||||
},
|
||||
|
||||
onAppReady: function (config) {
|
||||
@ -1460,22 +1528,19 @@ define([
|
||||
}));
|
||||
}
|
||||
if (me.btnStrikeout && me.btnStrikeout.menu) {
|
||||
var arr = me.createPen(me.btnStrikeout, 'strikeout', false, '-draw');
|
||||
me.mnuStrikeoutColorPicker = arr[0];
|
||||
Common.Utils.InternalSettings.set("pdfe-annot-opacity-strikeout", Common.localStorage.getItemAsInt("pdfe-annot-opacity-strikeout", 100));
|
||||
me.mnuStrikeoutColorPicker = me.createPen(me.btnStrikeout, 'strikeout', true);
|
||||
me.mnusStrikeoutColorPicker = [me.mnuStrikeoutColorPicker];
|
||||
// me.mnuStrikeoutTransparent = arr[1];
|
||||
}
|
||||
if (me.btnUnderline && me.btnUnderline.menu) {
|
||||
var arr = me.createPen(me.btnUnderline, 'underline', false, '-draw');
|
||||
me.mnuUnderlineColorPicker = arr[0];
|
||||
Common.Utils.InternalSettings.set("pdfe-annot-opacity-underline", Common.localStorage.getItemAsInt("pdfe-annot-opacity-underline", 100));
|
||||
me.mnuUnderlineColorPicker = me.createPen(me.btnUnderline, 'underline', true);
|
||||
me.mnusUnderlineColorPicker = [me.mnuUnderlineColorPicker];
|
||||
// me.mnuUnderlineTransparent = arr[1];
|
||||
}
|
||||
if (me.btnHighlight && me.btnHighlight.menu) {
|
||||
var arr = me.createPen(me.btnHighlight, 'highlight', false, '-draw');
|
||||
me.mnuHighlightColorPicker = arr[0];
|
||||
Common.Utils.InternalSettings.set("pdfe-annot-opacity-highlight", Common.localStorage.getItemAsInt("pdfe-annot-opacity-highlight", 50));
|
||||
me.mnuHighlightColorPicker = me.createPen(me.btnHighlight, 'highlight', true);
|
||||
me.mnusHighlightColorPicker = [me.mnuHighlightColorPicker];
|
||||
// me.mnuHighlightTransparent = arr[1];
|
||||
}
|
||||
|
||||
if (me.btnTextComment) {
|
||||
@ -1695,9 +1760,7 @@ define([
|
||||
this.btnTextHighlightColor.menu.setInnerMenu([{menu: this.mnuTextHighlightColorPicker, index: 0}]);
|
||||
}
|
||||
if (this.btnFontColor && this.btnFontColor.menu) {
|
||||
var arr = this.createPen(this.btnFontColor, 'font');
|
||||
this.mnuFontColorPicker = arr[0];
|
||||
this.mnuFontTransparent = arr[1];
|
||||
this.mnuFontColorPicker = this.createPen(this.btnFontColor, 'font');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -1242,6 +1242,7 @@
|
||||
"PDFE.Views.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.<br>Are you sure you want to continue?",
|
||||
"PDFE.Views.DocumentHolder.unicodeText": "Unicode",
|
||||
"PDFE.Views.DocumentHolder.vertAlignText": "Vertical alignment",
|
||||
"PDFE.Views.DocumentHolder.txtOpacity": "Opacity",
|
||||
"PDFE.Views.FileMenu.ariaFileMenu": "File menu",
|
||||
"PDFE.Views.FileMenu.btnBackCaption": "Open File Location",
|
||||
"PDFE.Views.FileMenu.btnCloseEditor": "Close File",
|
||||
@ -2017,6 +2018,7 @@
|
||||
"PDFE.Views.Toolbar.txtRotatePageRight": "Rotate page right",
|
||||
"PDFE.Views.Toolbar.txtRotateRight": "Rotate right",
|
||||
"PDFE.Views.Toolbar.txtUngroup": "Ungroup",
|
||||
"PDFE.Views.Toolbar.txtOpacity": "Opacity",
|
||||
"PDFE.Views.ViewTab.textAlwaysShowToolbar": "Always Show Toolbar",
|
||||
"PDFE.Views.ViewTab.textDarkDocument": "Dark Document",
|
||||
"PDFE.Views.ViewTab.textFill": "Fill",
|
||||
|
||||
Reference in New Issue
Block a user