[SSE] Set font settings for header/footer.

This commit is contained in:
Julia Radzhabova 2018-10-30 15:34:34 +03:00
parent 61e71afc82
commit ebb67c9b6e

View file

@ -48,7 +48,7 @@ define([
SSE.Views.HeaderFooterDialog = Common.UI.Window.extend(_.extend({ SSE.Views.HeaderFooterDialog = Common.UI.Window.extend(_.extend({
options: { options: {
width: 654, width: 660,
style: 'min-width: 350px;', style: 'min-width: 350px;',
cls: 'modal-dlg' cls: 'modal-dlg'
}, },
@ -78,19 +78,19 @@ define([
'<div style="margin-top: 15px;">', '<div style="margin-top: 15px;">',
'<div style="display: inline-block;margin-right: 10px;">', '<div style="display: inline-block;margin-right: 10px;">',
'<label style="font-weight: bold;">' + this.textLeft + '</label>', '<label style="font-weight: bold;">' + this.textLeft + '</label>',
'<div style="border: 1px solid #cbcbcb;width: 200px; height: 150px; position:relative; overflow:hidden;">', '<div style="border: 1px solid #cbcbcb;width: 201px; height: 150px; position:relative; overflow:hidden;">',
'<div id="headerfooter-left-img" style="width: 190px; height: 100%;"></div>', '<div id="headerfooter-left-img" style="width: 190px; height: 100%;"></div>',
'</div>', '</div>',
'</div>', '</div>',
'<div style="display: inline-block;margin-right: 10px;">', '<div style="display: inline-block;margin-right: 10px;">',
'<label style="font-weight: bold;">' + this.textCenter + '</label>', '<label style="font-weight: bold;">' + this.textCenter + '</label>',
'<div style="border: 1px solid #cbcbcb;width: 200px; height: 150px; position:relative; overflow:hidden;">', '<div style="border: 1px solid #cbcbcb;width: 201px; height: 150px; position:relative; overflow:hidden;">',
'<div id="headerfooter-center-img" style="width: 190px; height: 100%;"></div>', '<div id="headerfooter-center-img" style="width: 190px; height: 100%;"></div>',
'</div>', '</div>',
'</div>', '</div>',
'<div style="display: inline-block;">', '<div style="display: inline-block;">',
'<label style="font-weight: bold;">' + this.textRight + '</label>', '<label style="font-weight: bold;">' + this.textRight + '</label>',
'<div style="border: 1px solid #cbcbcb;width: 200px; height: 150px; position:relative; overflow:hidden;">', '<div style="border: 1px solid #cbcbcb;width: 201px; height: 150px; position:relative; overflow:hidden;">',
'<div id="headerfooter-right-img" style="width: 190px; height: 100%;"></div>', '<div id="headerfooter-right-img" style="width: 190px; height: 100%;"></div>',
'</div>', '</div>',
'</div>', '</div>',
@ -122,8 +122,8 @@ define([
recent : 0, recent : 0,
hint : me.tipFontName hint : me.tipFontName
}).on('selected', function(combo, record) { }).on('selected', function(combo, record) {
if (me.signObject) { if (me.HFObject) {
me.signObject.setText('Some text', record.name, me.font.size, me.font.italic, me.font.bold); me.HFObject.setFontName(record.name);
me.scrollerUpdate(); me.scrollerUpdate();
} }
me.font.name = record.name; me.font.name = record.name;
@ -155,8 +155,8 @@ define([
{ value: 72, displayValue: "72" } { value: 72, displayValue: "72" }
] ]
}).on('selected', function(combo, record) { }).on('selected', function(combo, record) {
if (me.signObject) { if (me.HFObject) {
me.signObject.setText('Some text', me.font.name, record.value, me.font.italic, me.font.bold); me.HFObject.setFontSize(record.value);
me.scrollerUpdate(); me.scrollerUpdate();
} }
me.font.size = record.value; me.font.size = record.value;
@ -171,8 +171,8 @@ define([
}); });
me.btnBold.render($('#id-dlg-sign-bold')) ; me.btnBold.render($('#id-dlg-sign-bold')) ;
me.btnBold.on('click', function(btn, e) { me.btnBold.on('click', function(btn, e) {
if (me.signObject) { if (me.HFObject) {
me.signObject.setText('Some text', me.font.name, me.font.size, me.font.italic, btn.pressed); me.HFObject.setBold(btn.pressed);
me.scrollerUpdate(); me.scrollerUpdate();
} }
me.font.bold = btn.pressed; me.font.bold = btn.pressed;
@ -186,8 +186,8 @@ define([
}); });
me.btnItalic.render($('#id-dlg-sign-italic')) ; me.btnItalic.render($('#id-dlg-sign-italic')) ;
me.btnItalic.on('click', function(btn, e) { me.btnItalic.on('click', function(btn, e) {
if (me.signObject) { if (me.HFObject) {
me.signObject.setText('Some text', me.font.name, me.font.size, btn.pressed, me.font.bold); me.HFObject.setItalic(btn.pressed);
me.scrollerUpdate(); me.scrollerUpdate();
} }
me.font.italic = btn.pressed; me.font.italic = btn.pressed;
@ -201,8 +201,8 @@ define([
}); });
me.btnUnderline.render($('#id-dlg-sign-underline')) ; me.btnUnderline.render($('#id-dlg-sign-underline')) ;
me.btnUnderline.on('click', function(btn, e) { me.btnUnderline.on('click', function(btn, e) {
if (me.signObject) { if (me.HFObject) {
me.signObject.setText('Some text', me.font.name, me.font.size, me.font.italic, me.font.bold); me.HFObject.setUnderline(btn.pressed);
me.scrollerUpdate(); me.scrollerUpdate();
} }
me.font.underline = btn.pressed; me.font.underline = btn.pressed;
@ -216,8 +216,8 @@ define([
}); });
me.btnStrikeout.render($('#id-dlg-sign-strikeout')) ; me.btnStrikeout.render($('#id-dlg-sign-strikeout')) ;
me.btnStrikeout.on('click', function(btn, e) { me.btnStrikeout.on('click', function(btn, e) {
if (me.signObject) { if (me.HFObject) {
me.signObject.setText('Some text', me.font.name, me.font.size, me.font.italic, me.font.bold); me.HFObject.setStrikeout(btn.pressed);
me.scrollerUpdate(); me.scrollerUpdate();
} }
me.font.strikeout = btn.pressed; me.font.strikeout = btn.pressed;
@ -232,8 +232,8 @@ define([
}); });
me.btnSuperscript.render($('#id-dlg-sign-superscript')) ; me.btnSuperscript.render($('#id-dlg-sign-superscript')) ;
me.btnSuperscript.on('click', function(btn, e) { me.btnSuperscript.on('click', function(btn, e) {
if (me.signObject) { if (me.HFObject) {
me.signObject.setText('Some text', me.font.name, me.font.size, me.font.italic, me.font.bold); me.HFObject.setSuperscript(btn.pressed);
me.scrollerUpdate(); me.scrollerUpdate();
} }
me.font.superscript = btn.pressed; me.font.superscript = btn.pressed;
@ -248,8 +248,8 @@ define([
}); });
me.btnSubscript.render($('#id-dlg-sign-subscript')) ; me.btnSubscript.render($('#id-dlg-sign-subscript')) ;
me.btnSubscript.on('click', function(btn, e) { me.btnSubscript.on('click', function(btn, e) {
if (me.signObject) { if (me.HFObject) {
me.signObject.setText('Some text', me.font.name, me.font.size, me.font.italic, me.font.bold); me.HFObject.setSubscript(btn.pressed);
me.scrollerUpdate(); me.scrollerUpdate();
} }
me.font.subscript = btn.pressed; me.font.subscript = btn.pressed;
@ -323,6 +323,10 @@ define([
if (this.options.handler) { if (this.options.handler) {
this.options.handler.call(this, this, state); this.options.handler.call(this, this, state);
} }
if (this.HFObject) {
this.HFObject.destroy(state=='ok');
this.HFObject = null;
}
this.close(); this.close();
}, },
@ -333,7 +337,9 @@ define([
}, },
onCanvasClick: function(id, event){ onCanvasClick: function(id, event){
this.HFObject.click(id, event.pageX*Common.Utils.zoom(), event.pageY*Common.Utils.zoom()); var parent = $(event.currentTarget).parent(),
offset = parent.offset();
this.HFObject.click(id, event.pageX*Common.Utils.zoom() - offset.left, event.pageY*Common.Utils.zoom() - offset.top + parent.scrollTop());
}, },
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',