mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
[ve] Add themed ShdwOffsetX ShdwOffsetY calculations; Fix bug 73686
This commit is contained in:
@ -2230,13 +2230,19 @@
|
||||
// shadow.putTransparency(60);
|
||||
shadow.color = shadowColor;
|
||||
|
||||
let shadowOffsetX_inch = this.getCellNumberValue("ShapeShdwOffsetX");
|
||||
let shadowOffsetY_inch = this.getCellNumberValue("ShapeShdwOffsetY");
|
||||
let shadowOffsetXcell = this.getCell("ShapeShdwOffsetX");
|
||||
let shadowOffsetYcell = this.getCell("ShapeShdwOffsetY");
|
||||
let shadowOffsetX_inch = shadowOffsetXcell.calculateValue(this, pageInfo, visioDocument.themes);
|
||||
let shadowOffsetY_inch = shadowOffsetYcell.calculateValue(this, pageInfo, visioDocument.themes);
|
||||
let shadowOffsetX = shadowOffsetX_inch === undefined ? 0 : shadowOffsetX_inch * g_dKoef_in_to_mm;
|
||||
let shadowOffsetY = shadowOffsetY_inch === undefined ? 0 : shadowOffsetY_inch * g_dKoef_in_to_mm;
|
||||
let atan = Math.atan2(shadowOffsetY, shadowOffsetX);
|
||||
shadow.dist = Math.hypot(shadowOffsetX, shadowOffsetY) * 36000;
|
||||
shadow.dir = -atan * AscFormat.radToDeg * AscFormat.degToC;
|
||||
shadow.dist = Math.hypot(shadowOffsetX, shadowOffsetY) * g_dKoef_mm_to_emu;
|
||||
// if true move to cord system where y goes down
|
||||
if (isInvertCoords) {
|
||||
atan = -atan;
|
||||
}
|
||||
shadow.dir = atan * AscFormat.radToDeg * AscFormat.degToC;
|
||||
|
||||
shadow.rotWithShape = true;
|
||||
// cShape.spPr.changeShadow(shadow);
|
||||
|
||||
@ -958,7 +958,8 @@
|
||||
let fillResultCells = ["LineColor", "FillForegnd", "FillBkgnd"];
|
||||
let fillColorResultCells = ["Color", "GradientStopColor", "ShdwForegnd"];
|
||||
let numberResultCells = ["LinePattern", "LineWeight", "GradientStopColorTrans", "GradientStopPosition",
|
||||
"FillGradientAngle", "EndArrowSize", "BeginArrowSize", "FillPattern", "LineCap", "ShdwPattern"];
|
||||
"FillGradientAngle", "EndArrowSize", "BeginArrowSize", "FillPattern", "LineCap", "ShdwPattern",
|
||||
"ShapeShdwOffsetX", "ShapeShdwOffsetY"];
|
||||
let stringResultCells = ["EndArrow", "BeginArrow", "Font"];
|
||||
let booleanResultCells = ["FillGradientEnabled"];
|
||||
|
||||
|
||||
@ -209,6 +209,13 @@
|
||||
isEffectIdx = true;
|
||||
|
||||
initialDefaultValue = AscFormat.CreateUniColorRGB(255,255,255);
|
||||
} else if (cellName === "ShapeShdwOffsetX" || cellName === "ShapeShdwOffsetY") {
|
||||
quickStyleCellName = "QuickStyleShadowColor";
|
||||
quickStyleModifiersCellName = "QuickStyleEffectsMatrix";
|
||||
getModifiersMethod = themes[0].getOuterShdw;
|
||||
isEffectIdx = true;
|
||||
|
||||
initialDefaultValue = 0;
|
||||
} else {
|
||||
AscCommon.consoleLog("themeval argument error. cell name: " + cellName + " is unknown. return undefined.");
|
||||
return undefined;
|
||||
@ -502,6 +509,22 @@
|
||||
} else if (cellName === "ShdwForegnd") {
|
||||
let shadowColor = getMedifiersResult && getMedifiersResult.color;
|
||||
result = shadowColor;
|
||||
} else if (cellName === "ShapeShdwOffsetX" || cellName === "ShapeShdwOffsetY") {
|
||||
let dir = getMedifiersResult && getMedifiersResult.dir;
|
||||
let dist = getMedifiersResult && getMedifiersResult.dist;
|
||||
|
||||
let dist_inches = dist * g_dKoef_emu_to_mm / g_dKoef_in_to_mm;
|
||||
let dir_radians = dir * AscFormat.cToRad;
|
||||
|
||||
// We are now in ooxml cord type system where y goes down.
|
||||
// Let's convert to MS Euclidean cord system where y goes up.
|
||||
dir_radians = -1 * dir_radians;
|
||||
|
||||
if (cellName === "ShapeShdwOffsetX") {
|
||||
result = dist_inches * Math.cos(dir_radians);
|
||||
} else {
|
||||
result = dist_inches * Math.sin(dir_radians);
|
||||
}
|
||||
} else {
|
||||
AscCommon.consoleLog("Error in themeval. result is not changed to appropriate type or quickStyleCellName is not set.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user