Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
web-apps
Commits
5f1958cc
Commit
5f1958cc
authored
Dec 13, 2016
by
Alexander Yuzhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SE mobile] Chart settings, type and styles.
parent
cdcb9344
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
24 deletions
+88
-24
apps/spreadsheeteditor/mobile/app/controller/edit/EditChart.js
...spreadsheeteditor/mobile/app/controller/edit/EditChart.js
+82
-17
apps/spreadsheeteditor/mobile/app/view/edit/EditChart.js
apps/spreadsheeteditor/mobile/app/view/edit/EditChart.js
+6
-7
No files found.
apps/spreadsheeteditor/mobile/app/controller/edit/EditChart.js
View file @
5f1958cc
...
...
@@ -53,8 +53,7 @@ define([
SSE
.
Controllers
.
EditChart
=
Backbone
.
Controller
.
extend
(
_
.
extend
((
function
()
{
var
_stack
=
[],
_chartInfo
=
{},
_chartStyles
=
[],
_chartObject
=
{},
_borderInfo
=
{
color
:
'
000000
'
,
width
:
1
},
_isEdit
=
false
;
...
...
@@ -79,6 +78,8 @@ define([
var
me
=
this
;
me
.
api
=
api
;
me
.
api
.
asc_registerCallback
(
'
asc_onSelectionChanged
'
,
_
.
bind
(
me
.
onApiSelectionChanged
,
me
));
me
.
api
.
asc_registerCallback
(
'
asc_onUpdateChartStyles
'
,
_
.
bind
(
me
.
onApiUpdateChartStyles
,
me
));
// me.api.asc_registerCallback('asc_onSelectionChanged', _.bind(me.onApiSelectionChanged, me));
// me.api.asc_registerCallback('asc_onEditorSelectionChanged', _.bind(me.onApiEditorSelectionChanged, me));
// me.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(me.onApiInitEditorStyles, me)); // TODO: It does not work until the error in the SDK
...
...
@@ -95,8 +96,6 @@ define([
initEvents
:
function
()
{
var
me
=
this
;
me
.
getView
(
'
EditChart
'
).
renderStyles
(
_chartStyles
);
me
.
initSettings
();
},
...
...
@@ -109,8 +108,8 @@ define([
initSettings
:
function
(
pageId
)
{
var
me
=
this
;
if
(
'
#edit-chart-style
s
'
==
pageId
)
{
me
.
initStyle
s
Page
();
if
(
'
#edit-chart-style
'
==
pageId
)
{
me
.
initStylePage
();
}
else
if
(
'
#edit-chart-reorder
'
==
pageId
)
{
me
.
initReorderPage
();
}
else
{
...
...
@@ -125,11 +124,25 @@ define([
},
getChart
:
function
()
{
return
_chart
Info
;
return
_chart
Object
;
},
initStylesPage
:
function
()
{
//
initStylePage
:
function
()
{
var
me
=
this
,
chartProperties
=
_chartObject
.
get_ChartProperties
();
// Type
var
type
=
chartProperties
.
getType
();
$
(
'
.chart-types li
'
).
removeClass
(
'
active
'
);
$
(
'
.chart-types li[data-type=
'
+
type
+
'
]
'
).
addClass
(
'
active
'
);
$
(
'
#tab-chart-type li
'
).
single
(
'
click
'
,
_
.
buffered
(
me
.
onType
,
100
,
me
));
// Styles
_
.
defer
(
function
()
{
me
.
_updateChartStyles
(
me
.
api
.
asc_getChartPreviews
(
_chartObject
.
get_ChartProperties
().
getType
()));
});
},
initReorderPage
:
function
()
{
...
...
@@ -186,19 +199,52 @@ define([
this
.
api
.
asc_setSelectedDrawingObjectLayer
(
ascType
);
},
onType
:
function
(
e
)
{
var
me
=
this
,
$target
=
$
(
e
.
currentTarget
),
type
=
$target
.
data
(
'
type
'
);
$
(
'
.chart-types li
'
).
removeClass
(
'
active
'
);
$target
.
addClass
(
'
active
'
);
_
.
defer
(
function
()
{
var
image
=
new
Asc
.
asc_CImgProperty
(),
chart
=
_chartObject
.
get_ChartProperties
();
chart
.
changeType
(
type
);
image
.
put_ChartProperties
(
chart
);
me
.
api
.
asc_setGraphicObjectProps
(
image
);
// Force update styles
me
.
_updateChartStyles
(
me
.
api
.
asc_getChartPreviews
(
chart
.
getType
()));
});
},
onStyle
:
function
(
e
)
{
var
me
=
this
,
$target
=
$
(
e
.
currentTarget
),
type
=
$target
.
data
(
'
type
'
);
var
image
=
new
Asc
.
asc_CImgProperty
(),
chart
=
_chartObject
.
get_ChartProperties
();
chart
.
putStyle
(
type
);
image
.
put_ChartProperties
(
chart
);
me
.
api
.
asc_setGraphicObjectProps
(
image
);
},
onFillColor
:
function
(
palette
,
color
)
{
this
.
api
.
asc_setCellBackgroundColor
(
color
==
'
transparent
'
?
null
:
Common
.
Utils
.
ThemeColor
.
getRgbColor
(
color
));
},
// API handlers
onApi
EditorSelectionChanged
:
function
(
fontObj
)
{
if
(
!
_isEdit
)
{
return
;
onApi
UpdateChartStyles
:
function
(
)
{
if
(
this
.
api
&&
_chartObject
&&
_chartObject
.
get_ChartProperties
()
)
{
this
.
_updateChartStyles
(
this
.
api
.
asc_getChartPreviews
(
_chartObject
.
get_ChartProperties
().
getType
()))
;
}
//
// _fontInfo = fontObj;
// this.initFontSettings(fontObj);
},
onApiSelectionChanged
:
function
(
cellInfo
)
{
...
...
@@ -206,12 +252,31 @@ define([
return
;
}
// _cellInfo = cellInfo;
// this.initCellSettings(cellInfo);
if
(
cellInfo
.
asc_getFlags
().
asc_getSelectionType
()
==
Asc
.
c_oAscSelectionType
.
RangeChart
)
{
var
selectedObjects
=
this
.
api
.
asc_getGraphicObjectProps
();
for
(
var
i
=
0
;
i
<
selectedObjects
.
length
;
i
++
)
{
if
(
selectedObjects
[
i
].
asc_getObjectType
()
==
Asc
.
c_oAscTypeSelectElement
.
Image
)
{
var
elValue
=
selectedObjects
[
i
].
asc_getObjectValue
();
var
chartProps
=
elValue
.
asc_getChartProperties
();
// isObjLocked = isObjLocked || elValue.asc_getLocked();
if
(
chartProps
)
{
_chartObject
=
elValue
;
break
;
}
}
}
}
},
// Helpers
_updateChartStyles
:
function
(
styles
)
{
this
.
getView
(
'
EditChart
'
).
renderStyles
(
styles
);
$
(
'
#tab-chart-style li
'
).
single
(
'
click
'
,
_
.
bind
(
this
.
onStyle
,
this
));
},
_sdkToThemeColor
:
function
(
color
)
{
var
clr
=
'
transparent
'
;
...
...
apps/spreadsheeteditor/mobile/app/view/edit/EditChart.js
View file @
5f1958cc
...
...
@@ -52,7 +52,6 @@ define([
SSE
.
Views
.
EditChart
=
Backbone
.
View
.
extend
(
_
.
extend
((
function
()
{
// private
var
_editTextController
,
_styles
=
[],
_types
=
[
{
type
:
Asc
.
c_oAscChartTypeSettings
.
barNormal
,
thumb
:
'
chart-03.png
'
},
{
type
:
Asc
.
c_oAscChartTypeSettings
.
barStacked
,
thumb
:
'
chart-02.png
'
},
...
...
@@ -136,7 +135,7 @@ define([
},
renderStyles
:
function
(
chartStyles
)
{
var
$styleContainer
=
$
(
'
.chart-styles .item-content
'
);
var
$styleContainer
=
$
(
'
#tab-chart-style
'
);
if
(
$styleContainer
.
length
>
0
)
{
var
columns
=
parseInt
(
$styleContainer
.
width
()
/
70
),
// magic
...
...
@@ -154,11 +153,11 @@ define([
var
template
=
_
.
template
([
'
<% _.each(styles, function(row) { %>
'
,
'
<ul class="row">
'
,
'
<% _.each(row, function(style) { %>
'
,
'
<li data-type="<%= style.asc_getNam
e() %>">
'
,
'
<img src="<%= style.asc_getImage
() %>" width="50px" height="50px">
'
,
'
</li>
'
,
'
<% }); %>
'
,
'
<% _.each(row, function(style) { %>
'
,
'
<li data-type="<%= style.asc_getStyl
e() %>">
'
,
'
<img src="<%= style.asc_getImageUrl
() %>" width="50px" height="50px">
'
,
'
</li>
'
,
'
<% }); %>
'
,
'
</ul>
'
,
'
<% }); %>
'
].
join
(
''
),
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment