mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
[ve] Move color theme index calculation to function
This commit is contained in:
@ -1819,6 +1819,33 @@
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberof Shape_Type
|
||||
* returns index of color shape theme
|
||||
*/
|
||||
Shape_Type.prototype.calculateColorThemeIndex = function calculateColorThemeIndex(pageInfo) {
|
||||
let themeIndex = 0; // zero index means no theme - use default values
|
||||
let themeScopeCellName = this.isConnectorStyleIherited ? "ConnectorSchemeIndex" : "ColorSchemeIndex";
|
||||
let shapeColorSchemeThemeIndex = this.getCellNumberValue(themeScopeCellName);
|
||||
if (isNaN(shapeColorSchemeThemeIndex)) {
|
||||
// if not found or smth
|
||||
// shapeColorSchemeThemeIndex = 0; // zero index means no theme
|
||||
themeIndex = 0; // zero index means no theme
|
||||
} else if (shapeColorSchemeThemeIndex === 65534) {
|
||||
let pageThemeIndex = pageInfo.pageSheet.getCellNumberValue(themeScopeCellName);
|
||||
if (!isNaN(pageThemeIndex)) {
|
||||
themeIndex = pageThemeIndex;
|
||||
} else {
|
||||
// it's ok sometimes
|
||||
// AscCommon.consoleLog("pageThemeIndexCell not found");
|
||||
themeIndex = 0;
|
||||
}
|
||||
} else {
|
||||
themeIndex = shapeColorSchemeThemeIndex;
|
||||
}
|
||||
return themeIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* get deep copy of object with prototypes
|
||||
* @param object
|
||||
|
||||
@ -239,24 +239,7 @@
|
||||
// and pick ColorSchemeIndex instead of ThemeIndex cell
|
||||
// upd: if connector styles are used lets use ConnectorSchemeIndex cell and
|
||||
// ext uri="{D75FF423-9257-4291-A4FE-1B2448832E17} - themeSchemeSchemeEnum to find theme
|
||||
let themeIndex = 0; // zero index means no theme - use default values
|
||||
let themeScopeCellName = isConnectorShape ? "ConnectorSchemeIndex" : "ColorSchemeIndex";
|
||||
let shapeColorSchemeThemeIndex = shape.getCellNumberValue(themeScopeCellName);
|
||||
if (isNaN(shapeColorSchemeThemeIndex)) {
|
||||
shapeColorSchemeThemeIndex = 0; // zero index means no theme
|
||||
}
|
||||
if (shapeColorSchemeThemeIndex === 65534) {
|
||||
let pageThemeIndex = pageInfo.pageSheet.getCellNumberValue(themeScopeCellName);
|
||||
if (!isNaN(pageThemeIndex)) {
|
||||
themeIndex = pageThemeIndex;
|
||||
} else {
|
||||
// it's ok sometimes
|
||||
// AscCommon.consoleLog("pageThemeIndexCell not found");
|
||||
themeIndex = 0;
|
||||
}
|
||||
} else {
|
||||
themeIndex = shapeColorSchemeThemeIndex;
|
||||
}
|
||||
let themeIndex = shape.calculateColorThemeIndex(pageInfo);
|
||||
|
||||
|
||||
// if THEMEVAL was called with themeValue (argument like "FillColor") even if themeIndex is 0 we should
|
||||
|
||||
Reference in New Issue
Block a user