Commit 71493e12 authored by zhengke's avatar zhengke

logo

parent 2acaddfb
...@@ -555,12 +555,16 @@ const getColorShade = async (newSlides:any) => { ...@@ -555,12 +555,16 @@ const getColorShade = async (newSlides:any) => {
if (getRgbLevel(colorList.value[j].Color) > 50) dark = true if (getRgbLevel(colorList.value[j].Color) > 50) dark = true
} }
for(let i=0;i<newSlides.length;i++){ for(let i=0;i<newSlides.length;i++){
day = 0
if(i>colorList.value.length-2) { if(i>colorList.value.length-2) {
dark = false dark = false
day = 1
} }
let x = newSlides[i] let x = newSlides[i]
let eles = x.elements.filter(y=>y.layerName && y.layerName.indexOf('logo')!=-1) let eles = x.elements.filter(y=>y.layerName && y.layerName.indexOf('logo')!=-1)
let layerNames = x.elements.filter(z=>{
if(z.layerName&&z.layerName.indexOf('DAY')!=-1) return z
})
day = layerNames&&layerNames.length>0?1:0
let newElementsImg = await ResolveTripLogoHandler(eles,i,dark,day) let newElementsImg = await ResolveTripLogoHandler(eles,i,dark,day)
let newElements = [] let newElements = []
x.elements.forEach(y=>{ x.elements.forEach(y=>{
...@@ -594,9 +598,9 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da ...@@ -594,9 +598,9 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da
let Colors = templateObj[i].layerName.split(',') let Colors = templateObj[i].layerName.split(',')
let y = templateObj[i] let y = templateObj[i]
let tempSize = await FileService.getImageSizeWithoutDownloading(templateObj[i].src) let tempSize = await FileService.getImageSizeWithoutDownloading(templateObj[i].src)
let scale = parseInt(tempSize.width/tempSize.height) let scale = parseInt(y.width/y.height)
let url = '' let url = ''
// if(Colors[1]||scale==6) templateObj[i].filters.invert = '20%' console.log()
if(scale>=1&&scale<3&&!day) url = dark==true?acquiesceLogo.value[0]:acquiesceLogo.value[3] if(scale>=1&&scale<3&&!day) url = dark==true?acquiesceLogo.value[0]:acquiesceLogo.value[3]
if(scale>=1&&scale<3&&day) url = acquiesceLogo.value[6] if(scale>=1&&scale<3&&day) url = acquiesceLogo.value[6]
if(scale<1) url = dark==true?acquiesceLogo.value[1]:acquiesceLogo.value[4] if(scale<1) url = dark==true?acquiesceLogo.value[1]:acquiesceLogo.value[4]
...@@ -610,7 +614,7 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da ...@@ -610,7 +614,7 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da
let ratio = newTempSize.width / y.width let ratio = newTempSize.width / y.width
width = y.width width = y.width
height = newTempSize.height / ratio height = newTempSize.height / ratio
if(height<y.height){ if(height>y.height){
ratio = height / y.height ratio = height / y.height
height = y.height height = y.height
width = width / ratio width = width / ratio
...@@ -618,6 +622,7 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da ...@@ -618,6 +622,7 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da
y.height = height y.height = height
y.width = width y.width = width
y.lock = false y.lock = false
delete y.clip
templateObj[i].src = url templateObj[i].src = url
if(tempNewSlide){ if(tempNewSlide){
tempNewSlide.elements.push(...templateObj) tempNewSlide.elements.push(...templateObj)
......
...@@ -135,12 +135,16 @@ const getColorShade = async (newSlides:any) => { ...@@ -135,12 +135,16 @@ const getColorShade = async (newSlides:any) => {
if (getRgbLevel(colorList.value[j].Color) > 50) dark = true if (getRgbLevel(colorList.value[j].Color) > 50) dark = true
} }
for(let i=0;i<newSlides.length;i++){ for(let i=0;i<newSlides.length;i++){
day = 0
if(i>colorList.value.length-2) { if(i>colorList.value.length-2) {
dark = false dark = false
day = 1
} }
let x = newSlides[i] let x = newSlides[i]
let eles = x.elements.filter(y=>y.layerName && y.layerName.indexOf('logo')!=-1) let eles = x.elements.filter(y=>y.layerName && y.layerName.indexOf('logo')!=-1)
let layerNames = x.elements.filter(z=>{
if(z.layerName&&z.layerName.indexOf('DAY')!=-1) return z
})
day = layerNames&&layerNames.length>0?1:0
let newElementsImg = await ResolveTripLogoHandler(eles,i,dark,day) let newElementsImg = await ResolveTripLogoHandler(eles,i,dark,day)
let newElements = [] let newElements = []
x.elements.forEach(y=>{ x.elements.forEach(y=>{
...@@ -168,9 +172,8 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da ...@@ -168,9 +172,8 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da
let Colors = templateObj[i].layerName.split(',') let Colors = templateObj[i].layerName.split(',')
let y = templateObj[i] let y = templateObj[i]
let tempSize = await FileService.getImageSizeWithoutDownloading(templateObj[i].src) let tempSize = await FileService.getImageSizeWithoutDownloading(templateObj[i].src)
let scale = parseInt(tempSize.width/tempSize.height) let scale = parseInt(y.width/y.height)
let url = '' let url = ''
// if(Colors[1]||scale==6) templateObj[i].filters.invert = '20%'
if(scale>=1&&scale<3&&!day) url = dark==true?acquiesceLogo.value[0]:acquiesceLogo.value[3] if(scale>=1&&scale<3&&!day) url = dark==true?acquiesceLogo.value[0]:acquiesceLogo.value[3]
if(scale>=1&&scale<3&&day) url = acquiesceLogo.value[6] if(scale>=1&&scale<3&&day) url = acquiesceLogo.value[6]
if(scale<1) url = dark==true?acquiesceLogo.value[1]:acquiesceLogo.value[4] if(scale<1) url = dark==true?acquiesceLogo.value[1]:acquiesceLogo.value[4]
...@@ -184,13 +187,14 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da ...@@ -184,13 +187,14 @@ const ResolveTripLogoHandler = async (items:any, slideIndex:number,dark:false,da
let ratio = newTempSize.width / y.width let ratio = newTempSize.width / y.width
width = y.width width = y.width
height = newTempSize.height / ratio height = newTempSize.height / ratio
if(height<y.height){ if(height>y.height){
ratio = height / y.height ratio = height / y.height
height = y.height height = y.height
width = width / ratio width = width / ratio
} }
y.height = height y.height = height
y.width = width y.width = width
delete y.clip
templateObj[i].src = url templateObj[i].src = url
if(tempNewSlide){ if(tempNewSlide){
tempNewSlide.elements.push(...templateObj) tempNewSlide.elements.push(...templateObj)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment