@@ -52,17 +52,41 @@ async function sample () {
5252 voiceOver : false
5353 }
5454
55- const sounds = [ sound1 , sound2 ]
55+ const sounds = [ sound1 , sound2 ]
5656 projectDataInstance . setSounds ( sounds )
5757
5858 const screens = projectDataInstance . getScreens ( )
5959 // set text on text holder area
6060 if ( screens && screens [ 0 ] ) {
61+ // check if screen duration is adjustable do some manipulations
62+ const isAdjustable = screens [ 0 ] . isDurationAdjustable ( )
63+
64+ if ( isAdjustable ) {
65+ const calculateDuration = screens [ 0 ] . calculateScreenDuration ( )
66+ console . log ( calculateDuration )
67+ const maxDuration = screens [ 0 ] . getMaxPossibleDuration ( )
68+ const desiredDuration = 5
69+
70+ if ( desiredDuration <= maxDuration ) {
71+ screens [ 0 ] . setDuration ( desiredDuration )
72+ }
73+ }
74+ // check if icon position is adjustable, then change the icon position
75+ if ( screens [ 0 ] . isIconPositionAdjustable ( ) ) {
76+ screens [ 0 ] . changeIconPosition ( )
77+ }
78+
6179 const areas = screens [ 0 ] . getAreas ( )
6280
6381 const area = areas [ 0 ]
6482 if ( area && area . type === 'text' ) {
65- area . setText ( 'sample text' )
83+ // check recommended character count for current area
84+ const recommendedCharacterCount = area . getRecommendedCharacterCount ( )
85+ const sampleText = 'sample text'
86+
87+ if ( sampleText . length <= recommendedCharacterCount ) {
88+ area . setText ( sampleText )
89+ }
6690 }
6791 }
6892 // set image on image holder area
@@ -145,7 +169,7 @@ async function sample () {
145169 areas : [
146170 {
147171 id : 3562168 ,
148- cords : [ 656 , 224 , 1048 , 224 , 1048 , 332 , 656 , 332 ] ,
172+ cords : [ 656 , 224 , 1048 , 224 , 1048 , 332 , 656 , 332 ] ,
149173 height : 108 ,
150174 order : 0 ,
151175 title : 'char_Angry_2' ,
0 commit comments