@@ -647,26 +647,42 @@ $(".draggable" ).draggable({ cursor: "move", snap: true , snapTolerance: 5, grid
647647
648648
649649 function sceneZoom() {
650- var zoomMode = parseInt(' { $SCENE_AUTO_SCALE } ' );
651- var zoomw = $(window).width();
650+ let zoomMode = parseInt(' { $SCENE_AUTO_SCALE } ' );
651+ let zoomw = $(window).width();
652652 if (window.innerWidth > 0 && window.innerWidth < zoomw) zoomw = window.innerWidth;
653- zoomw = zoomw/$(" #slider" ).width()*100;
654- var zoomh = $(window).height();
653+
654+ let maxElementX = 0;
655+ let maxElementY = 0;
656+
657+
658+ $(' .element_state' ).each(function() {
659+ let x = $( this ).position().left+$( this ).width()+10;
660+ let y = $( this ).position().top+$( this ).height()+10;
661+ if (x> maxElementX) maxElementX= x;
662+ if (y> maxElementY) maxElementY= y;
663+ } );
664+
665+ zoomw = Math.round(zoomw/maxElementX*100);
666+ let zoomh = $(window).height();
655667 if (window.innerHeight > 0 && window.innerHeight < zoomh) zoomh = window.innerHeight;
656- zoomh = zoomh/$(" #slider" ).height()*100;
668+ zoomh = Math.round(zoomh/maxElementY*100);
669+ let newZoom = ' ' ;
657670 if (zoomMode == 3) { // height
658- document.body.style.zoom = zoomh+" %"
671+ newZoom = zoomh+" %" ;
659672 }
660673 if (zoomMode == 2) { // width
661- document.body.style.zoom = zoomw+" %"
674+ newZoom = zoomw+" %" ;
662675 }
663676 if (zoomMode == 1) { // both
664677 if (zoomh < zoomw) {
665- document.body.style.zoom = zoomh+" %"
678+ newZoom = zoomh+" %" ;
666679 } else {
667- document.body.style.zoom = zoomw+" %"
680+ newZoom = zoomw+" %" ;
668681 }
669682 }
683+ if (newZoom!= ' ' ) {
684+ document.body.style.zoom = newZoom;
685+ }
670686
671687 }
672688
@@ -702,14 +718,14 @@ $(".draggable" ).draggable({ cursor: "move", snap: true , snapTolerance: 5, grid
702718 <source src =" { $SCENE .VIDEO_WALLPAPER} " type =" video/mp4" >
703719 </video >
704720 { /if }
705- <div id =" scene_wallpaper_{ $SCENE .ID} " style =" { if $SCENE .WALLPAPER!= " " } background-image :url ({$SCENE.WALLPAPER} );{if $SCENE .WALLPAPER _FIXED ==" 1 " }background-attachment: fixed;{ /if } { if $SCENE .WALLPAPER_NOREPEAT== " 1" } background-repeat: no-repeat;{ /if } { /if } ;" >
721+ <div id =" scene_wallpaper_{ $SCENE .ID} " style =" { if $SCENE .WALLPAPER!= " " } background-image :url ({$SCENE.WALLPAPER} );{if $SCENE .WALLPAPER _FIXED ==" 1 " }background-attachment: fixed;{ /if } { if $SCENE .WALLPAPER_NOREPEAT== " 1" } background-repeat: no-repeat;{ /if } width:100%;height:100%; { /if } ;" >
706722 <div id =" scene_background_{ $SCENE .ID} " style =" position :relative ;" >
707723 { function name= elements}
708724 { foreach $items as $ELEMENT }
709725 <!-- element { $ELEMENT .ID} -->
710726 { if isset($ELEMENT .ELEMENTS)}
711727 <div
712- class =" element_{ $ELEMENT .ID} type_{ $ELEMENT .TYPE} { if isset($ELEMENT .CSS_STYLE) && $ELEMENT .CSS_STYLE!= " " } style_{ $ELEMENT .CSS_STYLE} { /if } { if isset($ELEMENT .BACKGROUND) && $ELEMENT .BACKGROUND= =" 1" } container_background{ /if } { if isset($DRAGGABLE )} draggable{ /if } "
728+ class =" scene_element element_{ $ELEMENT .ID} type_{ $ELEMENT .TYPE} { if isset($ELEMENT .CSS_STYLE) && $ELEMENT .CSS_STYLE!= " " } style_{ $ELEMENT .CSS_STYLE} { /if } { if isset($ELEMENT .BACKGROUND) && $ELEMENT .BACKGROUND= =" 1" } container_background{ /if } { if isset($DRAGGABLE )} draggable{ /if } "
713729 style =" { if isset($ELEMENT .POSITION_TYPE) && $ELEMENT .POSITION_TYPE== " 0" } position :absolute ;left :{$ELEMENT.LEFT }px ;top :{$ELEMENT.TOP }px ;{/if }
714730 {if isset ($ELEMENT .ZINDEX ) && $ELEMENT .ZINDEX != " " }z-index:{ $ELEMENT .ZINDEX} ;{ /if }
715731 { if isset($ELEMENT .WIDTH) && $ELEMENT .WIDTH!= " 0" } width:{ $ELEMENT .WIDTH} px;{ /if } { if isset($ELEMENT .HEIGHT) && $ELEMENT .HEIGHT!= " 0" } height:{ $ELEMENT .HEIGHT} px;{ /if }
@@ -832,7 +848,8 @@ function onDocumentMouseDown( event ) {
832848
833849 { foreach $ELEMENT .STATES as $STATE }
834850 <div
835- class =" element_{ $ELEMENT .ID}
851+ class =" element_{ $ELEMENT .ID}
852+ element_state
836853 type_{ $ELEMENT .TYPE}
837854 { if $ELEMENT .CSS_STYLE!= " " } style_{ $ELEMENT .CSS_STYLE} { /if }
838855 state_{ $STATE .TITLE}
@@ -874,7 +891,11 @@ function onDocumentMouseDown( event ) {
874891
875892 { elements items= $SCENE .ELEMENTS}
876893
877- { if $SCENE .BACKGROUND!= " " } <div class =" scene_background" ><img src =" { $SCENE .BACKGROUND} " border =" 0" ></div >{ /if }
894+ { if $SCENE .BACKGROUND!= " " }
895+ <div class =" scene_background" >
896+ <img src =" { $SCENE .BACKGROUND} " border =" 0" >
897+ </div >
898+ { /if }
878899 </div >
879900 </div >
880901 { if $TOTAL_SCENES != " 1" } </li >{ /if }
0 commit comments