[SSE] Custom Color
This commit is contained in:
parent
99affc5cfd
commit
8558e8407a
|
@ -254,6 +254,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
showBorderColor: function () {
|
showBorderColor: function () {
|
||||||
|
var me = this;
|
||||||
var selector = '#edit-chart-border-color-view';
|
var selector = '#edit-chart-border-color-view';
|
||||||
this.showPage(selector, true);
|
this.showPage(selector, true);
|
||||||
|
|
||||||
|
|
|
@ -204,10 +204,7 @@ define([
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
|
|
||||||
var paletteFillColor = new Common.UI.ThemeColorPalette({
|
var paletteFillColor = this.getView('EditChart').paletteFillColor;
|
||||||
el: $('#tab-chart-fill'),
|
|
||||||
transparent: true
|
|
||||||
});
|
|
||||||
|
|
||||||
paletteFillColor.on('select', _.bind(me.onFillColor, me));
|
paletteFillColor.on('select', _.bind(me.onFillColor, me));
|
||||||
|
|
||||||
|
@ -533,9 +530,7 @@ define([
|
||||||
|
|
||||||
initBorderColorPage: function () {
|
initBorderColorPage: function () {
|
||||||
var me = this,
|
var me = this,
|
||||||
palette = new Common.UI.ThemeColorPalette({
|
palette = me.getView('EditChart').paletteBorderColor;
|
||||||
el: $('.page[data-page=edit-chart-border-color] .page-content')
|
|
||||||
});
|
|
||||||
|
|
||||||
if (palette) {
|
if (palette) {
|
||||||
palette.select(_borderInfo.color);
|
palette.select(_borderInfo.color);
|
||||||
|
|
|
@ -161,11 +161,7 @@ define([
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
|
|
||||||
var paletteFillColor = new Common.UI.ThemeColorPalette({
|
var paletteFillColor = me.getView('EditShape').paletteFillColor;
|
||||||
el: $('#tab-shape-fill'),
|
|
||||||
transparent: true
|
|
||||||
});
|
|
||||||
|
|
||||||
paletteFillColor.on('select', _.bind(me.onFillColor, me));
|
paletteFillColor.on('select', _.bind(me.onFillColor, me));
|
||||||
|
|
||||||
var fill = shapeProperties.asc_getFill(),
|
var fill = shapeProperties.asc_getFill(),
|
||||||
|
@ -223,9 +219,7 @@ define([
|
||||||
|
|
||||||
initBorderColorPage: function () {
|
initBorderColorPage: function () {
|
||||||
var me = this,
|
var me = this,
|
||||||
palette = new Common.UI.ThemeColorPalette({
|
palette = me.getView('EditShape').paletteBorderColor;
|
||||||
el: $('.page[data-page=edit-shape-border-color-view] .page-content')
|
|
||||||
});
|
|
||||||
|
|
||||||
if (palette) {
|
if (palette) {
|
||||||
palette.select(_borderInfo.color);
|
palette.select(_borderInfo.color);
|
||||||
|
|
|
@ -197,9 +197,7 @@ define([
|
||||||
initTextColorPage: function () {
|
initTextColorPage: function () {
|
||||||
var me = this,
|
var me = this,
|
||||||
color = me._sdkToThemeColor(_fontInfo.color),
|
color = me._sdkToThemeColor(_fontInfo.color),
|
||||||
palette = new Common.UI.ThemeColorPalette({
|
palette = me.getView('EditText').paletteTextColor;
|
||||||
el: $('.page[data-page=edit-text-color] .page-content')
|
|
||||||
});
|
|
||||||
|
|
||||||
if (palette) {
|
if (palette) {
|
||||||
palette.select(color);
|
palette.select(color);
|
||||||
|
|
|
@ -623,4 +623,20 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Custom color view -->
|
||||||
|
<div id="edit-chart-custom-color-view">
|
||||||
|
<div class="navbar">
|
||||||
|
<div class="navbar-inner" data-page="edit-chart-custom-color">
|
||||||
|
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
|
||||||
|
<div class="center sliding"><%= scope.textCustomColor %></div>
|
||||||
|
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="page" data-page="edit-chart-custom-color">
|
||||||
|
<div class="page-content">
|
||||||
|
<!--Color HSB palette-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -266,4 +266,20 @@
|
||||||
<!--Color palette-->
|
<!--Color palette-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Custom color view -->
|
||||||
|
<div id="edit-shape-custom-color-view">
|
||||||
|
<div class="navbar">
|
||||||
|
<div class="navbar-inner" data-page="edit-shape-custom-color">
|
||||||
|
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
|
||||||
|
<div class="center sliding"><%= scope.textCustomColor %></div>
|
||||||
|
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="page" data-page="edit-shape-custom-color">
|
||||||
|
<div class="page-content">
|
||||||
|
<!--Color HSB palette-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -117,3 +117,20 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Custom color view -->
|
||||||
|
<div id="edit-text-custom-color-view">
|
||||||
|
<div class="navbar">
|
||||||
|
<div class="navbar-inner" data-page="edit-text-custom-color">
|
||||||
|
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
|
||||||
|
<div class="center sliding"><%= scope.textCustomColor %></div>
|
||||||
|
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="page" data-page="edit-text-custom-color">
|
||||||
|
<div class="page-content">
|
||||||
|
<!--Color HSB palette-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -45,7 +45,8 @@ define([
|
||||||
'jquery',
|
'jquery',
|
||||||
'underscore',
|
'underscore',
|
||||||
'backbone',
|
'backbone',
|
||||||
'common/mobile/lib/component/ThemeColorPalette'
|
'common/mobile/lib/component/ThemeColorPalette',
|
||||||
|
'common/mobile/lib/component/HsbColorPicker'
|
||||||
], function (editTemplate, $, _, Backbone) {
|
], function (editTemplate, $, _, Backbone) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -179,6 +180,8 @@ define([
|
||||||
}).join(', ');
|
}).join(', ');
|
||||||
|
|
||||||
$(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this));
|
$(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this));
|
||||||
|
$('#chart-style').single('click', _.bind(this.showStyle, this));
|
||||||
|
$('#edit-chart-bordercolor').single('click', _.bind(this.showBorderColor, this));
|
||||||
|
|
||||||
$('.edit-chart-style.subnavbar.categories a').single('click', function () {
|
$('.edit-chart-style.subnavbar.categories a').single('click', function () {
|
||||||
$('.page[data-page=edit-chart-style]').find('.list-block.inputs-list').removeClass('inputs-list');
|
$('.page[data-page=edit-chart-style]').find('.list-block.inputs-list').removeClass('inputs-list');
|
||||||
|
@ -206,6 +209,104 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showStyle: function () {
|
||||||
|
var me = this;
|
||||||
|
var page = '#edit-chart-style';
|
||||||
|
this.showPage(page, true);
|
||||||
|
|
||||||
|
this.paletteFillColor = new Common.UI.ThemeColorPalette({
|
||||||
|
el: $('#tab-chart-fill'),
|
||||||
|
transparent: true
|
||||||
|
});
|
||||||
|
this.paletteFillColor.on('customcolor', function () {
|
||||||
|
me.showCustomFillColor();
|
||||||
|
});
|
||||||
|
var template = _.template(['<div class="list-block">',
|
||||||
|
'<ul>',
|
||||||
|
'<li>',
|
||||||
|
'<a id="edit-chart-add-custom-fill-color" class="item-link">',
|
||||||
|
'<div class="item-content">',
|
||||||
|
'<div class="item-inner">',
|
||||||
|
'<div class="item-title"><%= scope.textAddCustomColor %></div>',
|
||||||
|
'</div>',
|
||||||
|
'</div>',
|
||||||
|
'</a>',
|
||||||
|
'</li>',
|
||||||
|
'</ul>',
|
||||||
|
'</div>'].join(''));
|
||||||
|
$('#tab-chart-fill').append(template({scope: this}));
|
||||||
|
$('#edit-chart-add-custom-fill-color').single('click', _.bind(this.showCustomFillColor, this));
|
||||||
|
|
||||||
|
Common.Utils.addScrollIfNeed('.page[data-page=edit-chart-style]', '.page[data-page=edit-chart-style] .page-content');
|
||||||
|
this.fireEvent('page:show', [this, page]);
|
||||||
|
},
|
||||||
|
|
||||||
|
showCustomFillColor: function () {
|
||||||
|
var me = this,
|
||||||
|
selector = '#edit-chart-custom-color-view';
|
||||||
|
me.showPage(selector, true);
|
||||||
|
|
||||||
|
me.customFillColorPicker = new Common.UI.HsbColorPicker({
|
||||||
|
el: $('.page[data-page=edit-chart-custom-color] .page-content'),
|
||||||
|
color: me.paletteFillColor.currentColor
|
||||||
|
});
|
||||||
|
me.customFillColorPicker.on('addcustomcolor', function (colorPicker, color) {
|
||||||
|
me.paletteFillColor.addNewDynamicColor(colorPicker, color);
|
||||||
|
SSE.getController('EditContainer').rootView.router.back();
|
||||||
|
});
|
||||||
|
|
||||||
|
me.fireEvent('page:show', [me, selector]);
|
||||||
|
},
|
||||||
|
|
||||||
|
showBorderColor: function () {
|
||||||
|
var me = this;
|
||||||
|
var selector = '#edit-chart-border-color-view';
|
||||||
|
this.showPage(selector, true);
|
||||||
|
|
||||||
|
this.paletteBorderColor = new Common.UI.ThemeColorPalette({
|
||||||
|
el: $('.page[data-page=edit-chart-border-color] .page-content')
|
||||||
|
});
|
||||||
|
this.paletteBorderColor.on('customcolor', function () {
|
||||||
|
me.showCustomBorderColor();
|
||||||
|
});
|
||||||
|
var template = _.template(['<div class="list-block">',
|
||||||
|
'<ul>',
|
||||||
|
'<li>',
|
||||||
|
'<a id="edit-chart-add-custom-border-color" class="item-link">',
|
||||||
|
'<div class="item-content">',
|
||||||
|
'<div class="item-inner">',
|
||||||
|
'<div class="item-title"><%= scope.textAddCustomColor %></div>',
|
||||||
|
'</div>',
|
||||||
|
'</div>',
|
||||||
|
'</a>',
|
||||||
|
'</li>',
|
||||||
|
'</ul>',
|
||||||
|
'</div>'].join(''));
|
||||||
|
$('.page[data-page=edit-chart-border-color] .page-content').append(template({scope: this}));
|
||||||
|
$('#edit-chart-add-custom-border-color').single('click', _.bind(this.showCustomBorderColor, this));
|
||||||
|
|
||||||
|
this.fireEvent('page:show', [this, selector]);
|
||||||
|
},
|
||||||
|
|
||||||
|
showCustomBorderColor: function () {
|
||||||
|
var me = this,
|
||||||
|
selector = '#edit-chart-custom-color-view';
|
||||||
|
me.showPage(selector, true);
|
||||||
|
|
||||||
|
me.customBorderColorPicker = new Common.UI.HsbColorPicker({
|
||||||
|
el: $('.page[data-page=edit-chart-custom-color] .page-content'),
|
||||||
|
color: me.paletteBorderColor.currentColor
|
||||||
|
});
|
||||||
|
me.customBorderColorPicker.on('addcustomcolor', function (colorPicker, color) {
|
||||||
|
me.paletteBorderColor.addNewDynamicColor(colorPicker, color);
|
||||||
|
me.paletteFillColor.updateDynamicColors();
|
||||||
|
me.paletteFillColor.select(me.paletteFillColor.currentColor);
|
||||||
|
SSE.getController('EditContainer').rootView.router.back();
|
||||||
|
});
|
||||||
|
|
||||||
|
me.fireEvent('page:show', [me, selector]);
|
||||||
|
},
|
||||||
|
|
||||||
onItemClick: function (e) {
|
onItemClick: function (e) {
|
||||||
var $target = $(e.currentTarget),
|
var $target = $(e.currentTarget),
|
||||||
page = $target.data('page');
|
page = $target.data('page');
|
||||||
|
@ -266,7 +367,9 @@ define([
|
||||||
textLabelPos: 'Label Position',
|
textLabelPos: 'Label Position',
|
||||||
textAxisPosition: 'Axis Position',
|
textAxisPosition: 'Axis Position',
|
||||||
textNone: 'None',
|
textNone: 'None',
|
||||||
textGridlines: 'Gridlines'
|
textGridlines: 'Gridlines',
|
||||||
|
textAddCustomColor: 'Add Custom Color',
|
||||||
|
textCustomColor: 'Custom Color'
|
||||||
}
|
}
|
||||||
})(), SSE.Views.EditChart || {}))
|
})(), SSE.Views.EditChart || {}))
|
||||||
});
|
});
|
|
@ -43,7 +43,9 @@ define([
|
||||||
'text!spreadsheeteditor/mobile/app/template/EditShape.template',
|
'text!spreadsheeteditor/mobile/app/template/EditShape.template',
|
||||||
'jquery',
|
'jquery',
|
||||||
'underscore',
|
'underscore',
|
||||||
'backbone'
|
'backbone',
|
||||||
|
'common/mobile/lib/component/ThemeColorPalette',
|
||||||
|
'common/mobile/lib/component/HsbColorPicker'
|
||||||
], function (editTemplate, $, _, Backbone) {
|
], function (editTemplate, $, _, Backbone) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -61,17 +63,18 @@ define([
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
|
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
|
||||||
Common.NotificationCenter.on('editcategory:show', _.bind(this.categoryShow, this));
|
Common.NotificationCenter.on('editcategory:show', _.bind(this.categoryShow, this));
|
||||||
this.on('page:show', _.bind(this.updateItemHandlers, this));
|
//this.on('page:show', _.bind(this.updateItemHandlers, this));
|
||||||
this.isShapeCanFill = true;
|
this.isShapeCanFill = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
initEvents: function () {
|
initEvents: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
|
me.updateItemHandlers();
|
||||||
|
|
||||||
$('.edit-shape-style .categories a').single('click', _.bind(me.showStyleCategory, me));
|
$('.edit-shape-style .categories a').single('click', _.bind(me.showStyleCategory, me));
|
||||||
|
|
||||||
Common.Utils.addScrollIfNeed('#edit-shape .pages', '#edit-shape .page');
|
Common.Utils.addScrollIfNeed('#edit-shape .pages', '#edit-shape .page');
|
||||||
me.updateItemHandlers();
|
|
||||||
me.initControls();
|
me.initControls();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -121,6 +124,8 @@ define([
|
||||||
|
|
||||||
Common.Utils.addScrollIfNeed('.page[data-page=edit-shape-border-color-view]', '.page[data-page=edit-shape-border-color-view] .page-content');
|
Common.Utils.addScrollIfNeed('.page[data-page=edit-shape-border-color-view]', '.page[data-page=edit-shape-border-color-view] .page-content');
|
||||||
$(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this));
|
$(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this));
|
||||||
|
$('#shape-style').single('click', _.bind(this.showStyle, this));
|
||||||
|
$('#edit-shape-bordercolor').single('click', _.bind(this.showBorderColor, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
showPage: function (templateId, suspendEvent) {
|
showPage: function (templateId, suspendEvent) {
|
||||||
|
@ -146,6 +151,111 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showStyle: function () {
|
||||||
|
var me = this;
|
||||||
|
var page = '#edit-shape-style';
|
||||||
|
if (!this.isShapeCanFill) {
|
||||||
|
page = '#edit-shape-style-nofill';
|
||||||
|
}
|
||||||
|
this.showPage(page, true);
|
||||||
|
|
||||||
|
this.paletteFillColor = new Common.UI.ThemeColorPalette({
|
||||||
|
el: $('#tab-shape-fill'),
|
||||||
|
transparent: true
|
||||||
|
});
|
||||||
|
this.paletteFillColor.on('customcolor', function () {
|
||||||
|
me.showCustomFillColor();
|
||||||
|
});
|
||||||
|
var template = _.template(['<div class="list-block">',
|
||||||
|
'<ul>',
|
||||||
|
'<li>',
|
||||||
|
'<a id="edit-cell-add-custom-fill-color" class="item-link">',
|
||||||
|
'<div class="item-content">',
|
||||||
|
'<div class="item-inner">',
|
||||||
|
'<div class="item-title"><%= scope.textAddCustomColor %></div>',
|
||||||
|
'</div>',
|
||||||
|
'</div>',
|
||||||
|
'</a>',
|
||||||
|
'</li>',
|
||||||
|
'</ul>',
|
||||||
|
'</div>'].join(''));
|
||||||
|
$('#tab-shape-fill').append(template({scope: this}));
|
||||||
|
$('#edit-cell-add-custom-fill-color').single('click', _.bind(this.showCustomFillColor, this));
|
||||||
|
|
||||||
|
if (!this.isShapeCanFill)
|
||||||
|
this.showStyleCategory();
|
||||||
|
|
||||||
|
Common.Utils.addScrollIfNeed('.page[data-page=edit-shape-style]', '.page[data-page=edit-shape-style] .page-content');
|
||||||
|
this.fireEvent('page:show', [this, page]);
|
||||||
|
},
|
||||||
|
|
||||||
|
showCustomFillColor: function () {
|
||||||
|
var me = this,
|
||||||
|
selector = '#edit-shape-custom-color-view';
|
||||||
|
me.showPage(selector, true);
|
||||||
|
|
||||||
|
me.customFillColorPicker = new Common.UI.HsbColorPicker({
|
||||||
|
el: $('.page[data-page=edit-shape-custom-color] .page-content'),
|
||||||
|
color: me.paletteFillColor.currentColor
|
||||||
|
});
|
||||||
|
me.customFillColorPicker.on('addcustomcolor', function (colorPicker, color) {
|
||||||
|
me.paletteFillColor.addNewDynamicColor(colorPicker, color);
|
||||||
|
SSE.getController('EditContainer').rootView.router.back();
|
||||||
|
});
|
||||||
|
|
||||||
|
me.fireEvent('page:show', [me, selector]);
|
||||||
|
},
|
||||||
|
|
||||||
|
showBorderColor: function () {
|
||||||
|
var me = this;
|
||||||
|
var selector = '#edit-shape-border-color-view';
|
||||||
|
this.showPage(selector, true);
|
||||||
|
|
||||||
|
this.paletteBorderColor = new Common.UI.ThemeColorPalette({
|
||||||
|
el: $('.page[data-page=edit-shape-border-color-view] .page-content')
|
||||||
|
});
|
||||||
|
this.paletteBorderColor.on('customcolor', function () {
|
||||||
|
me.showCustomBorderColor();
|
||||||
|
});
|
||||||
|
var template = _.template(['<div class="list-block">',
|
||||||
|
'<ul>',
|
||||||
|
'<li>',
|
||||||
|
'<a id="edit-shape-add-custom-border-color" class="item-link">',
|
||||||
|
'<div class="item-content">',
|
||||||
|
'<div class="item-inner">',
|
||||||
|
'<div class="item-title"><%= scope.textAddCustomColor %></div>',
|
||||||
|
'</div>',
|
||||||
|
'</div>',
|
||||||
|
'</a>',
|
||||||
|
'</li>',
|
||||||
|
'</ul>',
|
||||||
|
'</div>'].join(''));
|
||||||
|
$('.page[data-page=edit-shape-border-color-view] .page-content').append(template({scope: this}));
|
||||||
|
$('#edit-shape-add-custom-border-color').single('click', _.bind(this.showCustomBorderColor, this));
|
||||||
|
|
||||||
|
this.fireEvent('page:show', [this, selector]);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
showCustomBorderColor: function () {
|
||||||
|
var me = this,
|
||||||
|
selector = '#edit-shape-custom-color-view';
|
||||||
|
me.showPage(selector, true);
|
||||||
|
|
||||||
|
me.customBorderColorPicker = new Common.UI.HsbColorPicker({
|
||||||
|
el: $('.page[data-page=edit-shape-custom-color] .page-content'),
|
||||||
|
color: me.paletteBorderColor.currentColor
|
||||||
|
});
|
||||||
|
me.customBorderColorPicker.on('addcustomcolor', function (colorPicker, color) {
|
||||||
|
me.paletteBorderColor.addNewDynamicColor(colorPicker, color);
|
||||||
|
me.paletteFillColor.updateDynamicColors();
|
||||||
|
me.paletteFillColor.select(me.paletteFillColor.currentColor);
|
||||||
|
SSE.getController('EditContainer').rootView.router.back();
|
||||||
|
});
|
||||||
|
|
||||||
|
me.fireEvent('page:show', [me, selector]);
|
||||||
|
},
|
||||||
|
|
||||||
showStyleCategory: function (e) {
|
showStyleCategory: function (e) {
|
||||||
// remove android specific style
|
// remove android specific style
|
||||||
$('.page[data-page=edit-shape-style] .list-block.inputs-list').removeClass('inputs-list');
|
$('.page[data-page=edit-shape-style] .list-block.inputs-list').removeClass('inputs-list');
|
||||||
|
@ -156,13 +266,9 @@ define([
|
||||||
page = $target.data('page');
|
page = $target.data('page');
|
||||||
|
|
||||||
if (page && page.length > 0 ) {
|
if (page && page.length > 0 ) {
|
||||||
if (page == '#edit-shape-style' && !this.isShapeCanFill)
|
|
||||||
page = '#edit-shape-style-nofill';
|
|
||||||
|
|
||||||
this.showPage(page);
|
this.showPage(page);
|
||||||
|
|
||||||
if (!this.isShapeCanFill)
|
|
||||||
this.showStyleCategory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Common.Utils.addScrollIfNeed('.page[data-page=edit-shape-style]', '.page[data-page=edit-shape-style] .page-content');
|
Common.Utils.addScrollIfNeed('.page[data-page=edit-shape-style]', '.page[data-page=edit-shape-style] .page-content');
|
||||||
|
@ -184,7 +290,9 @@ define([
|
||||||
textEffects: 'Effects',
|
textEffects: 'Effects',
|
||||||
textSize: 'Size',
|
textSize: 'Size',
|
||||||
textColor: 'Color',
|
textColor: 'Color',
|
||||||
textOpacity: 'Opacity'
|
textOpacity: 'Opacity',
|
||||||
|
textAddCustomColor: 'Add Custom Color',
|
||||||
|
textCustomColor: 'Custom Color'
|
||||||
}
|
}
|
||||||
})(), SSE.Views.EditShape || {}))
|
})(), SSE.Views.EditShape || {}))
|
||||||
});
|
});
|
|
@ -44,7 +44,9 @@ define([
|
||||||
'text!spreadsheeteditor/mobile/app/template/EditText.template',
|
'text!spreadsheeteditor/mobile/app/template/EditText.template',
|
||||||
'jquery',
|
'jquery',
|
||||||
'underscore',
|
'underscore',
|
||||||
'backbone'
|
'backbone',
|
||||||
|
'common/mobile/lib/component/ThemeColorPalette',
|
||||||
|
'common/mobile/lib/component/HsbColorPicker'
|
||||||
], function (editTemplate, $, _, Backbone) {
|
], function (editTemplate, $, _, Backbone) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -62,7 +64,6 @@ define([
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
|
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
|
||||||
Common.NotificationCenter.on('fonts:load', _.bind(this.onApiFontsLoad, this));
|
Common.NotificationCenter.on('fonts:load', _.bind(this.onApiFontsLoad, this));
|
||||||
this.on('page:show', _.bind(this.updateItemHandlers, this));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initEvents: function () {
|
initEvents: function () {
|
||||||
|
@ -105,6 +106,7 @@ define([
|
||||||
}).join(', ');
|
}).join(', ');
|
||||||
|
|
||||||
$(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this));
|
$(selectorsDynamicPage).single('click', _.bind(this.onItemClick, this));
|
||||||
|
$('#font-color').single('click', _.bind(this.showFontColor, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
showPage: function (templateId, suspendEvent) {
|
showPage: function (templateId, suspendEvent) {
|
||||||
|
@ -130,6 +132,55 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showFontColor: function () {
|
||||||
|
var me = this;
|
||||||
|
var page = '#edit-text-color';
|
||||||
|
this.showPage(page, true);
|
||||||
|
|
||||||
|
this.paletteTextColor = new Common.UI.ThemeColorPalette({
|
||||||
|
el: $('.page[data-page=edit-text-color] .page-content'),
|
||||||
|
transparent: true
|
||||||
|
});
|
||||||
|
this.paletteTextColor.on('customcolor', function () {
|
||||||
|
me.showCustomFillColor();
|
||||||
|
});
|
||||||
|
var template = _.template(['<div class="list-block">',
|
||||||
|
'<ul>',
|
||||||
|
'<li>',
|
||||||
|
'<a id="edit-text-add-custom-fill-color" class="item-link">',
|
||||||
|
'<div class="item-content">',
|
||||||
|
'<div class="item-inner">',
|
||||||
|
'<div class="item-title"><%= scope.textAddCustomColor %></div>',
|
||||||
|
'</div>',
|
||||||
|
'</div>',
|
||||||
|
'</a>',
|
||||||
|
'</li>',
|
||||||
|
'</ul>',
|
||||||
|
'</div>'].join(''));
|
||||||
|
$('.page[data-page=edit-text-color] .page-content').append(template({scope: this}));
|
||||||
|
$('#edit-text-add-custom-fill-color').single('click', _.bind(this.showCustomTextColor, this));
|
||||||
|
|
||||||
|
Common.Utils.addScrollIfNeed('.page[data-page=edit-text]', '.page[data-page=edit-text] .page-content');
|
||||||
|
this.fireEvent('page:show', [this, page]);
|
||||||
|
},
|
||||||
|
|
||||||
|
showCustomTextColor: function () {
|
||||||
|
var me = this,
|
||||||
|
selector = '#edit-text-custom-color-view';
|
||||||
|
me.showPage(selector, true);
|
||||||
|
|
||||||
|
me.customTextColorPicker = new Common.UI.HsbColorPicker({
|
||||||
|
el: $('.page[data-page=edit-text-custom-color] .page-content'),
|
||||||
|
color: me.paletteTextColor.currentColor
|
||||||
|
});
|
||||||
|
me.customTextColorPicker.on('addcustomcolor', function (colorPicker, color) {
|
||||||
|
me.paletteTextColor.addNewDynamicColor(colorPicker, color);
|
||||||
|
SSE.getController('EditContainer').rootView.router.back();
|
||||||
|
});
|
||||||
|
|
||||||
|
me.fireEvent('page:show', [me, selector]);
|
||||||
|
},
|
||||||
|
|
||||||
renderFonts: function () {
|
renderFonts: function () {
|
||||||
var me = this,
|
var me = this,
|
||||||
$template = $(
|
$template = $(
|
||||||
|
@ -180,7 +231,9 @@ define([
|
||||||
textSize: 'Size',
|
textSize: 'Size',
|
||||||
textCharacterBold: 'B',
|
textCharacterBold: 'B',
|
||||||
textCharacterItalic: 'I',
|
textCharacterItalic: 'I',
|
||||||
textCharacterUnderline: 'U'
|
textCharacterUnderline: 'U',
|
||||||
|
textAddCustomColor: 'Add Custom Color',
|
||||||
|
textCustomColor: 'Custom Color'
|
||||||
}
|
}
|
||||||
})(), SSE.Views.EditText || {}))
|
})(), SSE.Views.EditText || {}))
|
||||||
});
|
});
|
Loading…
Reference in a new issue