Skip to content

Commit

Permalink
Add ability to rotate image
Browse files Browse the repository at this point in the history
  • Loading branch information
alabaki committed Jan 5, 2020
1 parent f267a8e commit 7d80fa8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/core-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export interface IImageOpts extends PositionOptions, OptsDataOrPath {
hyperlink?: HyperLink
rounding?: boolean
placeholder?: any
rotate?: number
}
export interface IMediaOpts extends PositionOptions, OptsDataOrPath {
link: string
Expand Down
11 changes: 6 additions & 5 deletions src/gen-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ export function addChartDefinition(target: ISlide, type: CHART_TYPE_NAMES | ICha
options.chartColors = Array.isArray(options.chartColors)
? options.chartColors
: options.type === CHART_TYPES.PIE || options.type === CHART_TYPES.DOUGHNUT
? PIECHART_COLORS
: BARCHART_COLORS
? PIECHART_COLORS
: BARCHART_COLORS
options.chartColorsOpacity = options.chartColorsOpacity && !isNaN(options.chartColorsOpacity) ? options.chartColorsOpacity : null
//
options.border = options.border && typeof options.border === 'object' ? options.border : null
Expand All @@ -265,8 +265,8 @@ export function addChartDefinition(target: ISlide, type: CHART_TYPE_NAMES | ICha
options.dataLabelFormatCode && typeof options.dataLabelFormatCode === 'string'
? options.dataLabelFormatCode
: options.type === CHART_TYPES.PIE || options.type === CHART_TYPES.DOUGHNUT
? '0%'
: '#,##0'
? '0%'
: '#,##0'
//
// Set default format for Scatter chart labels to custom string if not defined
if (!options.dataLabelFormatScatter && options.type === CHART_TYPES.SCATTER) options.dataLabelFormatScatter = 'custom'
Expand Down Expand Up @@ -363,6 +363,7 @@ export function addImageDefinition(target: ISlide, opt: IImageOpts) {
rounding: typeof opt.rounding === 'boolean' ? opt.rounding : false,
sizing: sizing,
placeholder: opt.placeholder,
rotate: opt.rotate || 0
}

// STEP 4: Add this image to this Slide Rels (rId/rels count spans all slides! Count all images to get next rId)
Expand Down Expand Up @@ -888,7 +889,7 @@ export function addTextDefinition(target: ISlide, text: string | IText[], opts:
*/
export function addPlaceholdersToSlideLayouts(slide: ISlide) {
// Add all placeholders on this Slide that dont already exist
;(slide.slideLayout.data || []).forEach(slideLayoutObj => {
; (slide.slideLayout.data || []).forEach(slideLayoutObj => {
if (slideLayoutObj.type === SLIDE_OBJECT_TYPES.placeholder) {
// A: Search for this placeholder on Slide before we add
// NOTE: Check to ensure a placeholder does not already exist on the Slide
Expand Down

0 comments on commit 7d80fa8

Please sign in to comment.