Skip to content

Commit

Permalink
finalize work on Pull #889
Browse files Browse the repository at this point in the history
  • Loading branch information
gitbrent committed Apr 23, 2021
1 parent 38f11a6 commit cdf0304
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/gen-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,22 @@ export function createGlowElement(options: TextGlowProps, defaults: TextGlowProp

/**
* Create color selection
* @param shapeFill - options
* @param {Color | ShapeFillProps | ShapeLineProps} props fill props
* @returns XML string
*/
export function genXmlColorSelection(shapeFill: Color | ShapeFillProps | ShapeLineProps): string {
let colorVal = ''
export function genXmlColorSelection(props: Color | ShapeFillProps | ShapeLineProps): string {
let fillType = 'solid'
let colorVal = ''
let internalElements = ''
let outText = ''

if (shapeFill) {
if (typeof shapeFill === 'string') colorVal = shapeFill
if (props) {
if (typeof props === 'string') colorVal = props
else {
if (shapeFill.type) fillType = shapeFill.type
if (shapeFill.color) colorVal = shapeFill.color
if (shapeFill.alpha) internalElements += `<a:alpha val="${Math.round((100 - shapeFill.alpha) * 1000)}"/>` // DEPRECATED: @deprecated v3.3.0
if (shapeFill.transparency) internalElements += `<a:alpha val="${Math.round((100 - shapeFill.transparency) * 1000)}"/>`
if (props.type) fillType = props.type
if (props.color) colorVal = props.color
if (props.alpha) internalElements += `<a:alpha val="${Math.round((100 - props.alpha) * 1000)}"/>` // DEPRECATED: @deprecated v3.3.0
if (props.transparency) internalElements += `<a:alpha val="${Math.round((100 - props.transparency) * 1000)}"/>`
}

switch (fillType) {
Expand Down
2 changes: 1 addition & 1 deletion src/gen-xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ function slideObjectToXml(slide: PresSlide | SlideLayout): string {
// shape Type: LINE: line color
if (slideItemObj.options.line) {
strSlideXml += slideItemObj.options.line.width ? `<a:ln w="${valToPts(slideItemObj.options.line.width)}">` : '<a:ln>'
strSlideXml += genXmlColorSelection(slideItemObj.options.line)
if (slideItemObj.options.line.color) strSlideXml += genXmlColorSelection(slideItemObj.options.line)
if (slideItemObj.options.line.dashType) strSlideXml += `<a:prstDash val="${slideItemObj.options.line.dashType}"/>`
if (slideItemObj.options.line.beginArrowType) strSlideXml += `<a:headEnd type="${slideItemObj.options.line.beginArrowType}"/>`
if (slideItemObj.options.line.endArrowType) strSlideXml += `<a:tailEnd type="${slideItemObj.options.line.endArrowType}"/>`
Expand Down

0 comments on commit cdf0304

Please # to comment.