@@ -647,26 +647,42 @@ $(".draggable" ).draggable({ cursor: "move", snap: true , snapTolerance: 5, grid
647
647
648
648
649
649
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();
652
652
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();
655
667
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 = ' ' ;
657
670
if (zoomMode == 3) { // height
658
- document.body.style.zoom = zoomh+" %"
671
+ newZoom = zoomh+" %" ;
659
672
}
660
673
if (zoomMode == 2) { // width
661
- document.body.style.zoom = zoomw+" %"
674
+ newZoom = zoomw+" %" ;
662
675
}
663
676
if (zoomMode == 1) { // both
664
677
if (zoomh < zoomw) {
665
- document.body.style.zoom = zoomh+" %"
678
+ newZoom = zoomh+" %" ;
666
679
} else {
667
- document.body.style.zoom = zoomw+" %"
680
+ newZoom = zoomw+" %" ;
668
681
}
669
682
}
683
+ if (newZoom!= ' ' ) {
684
+ document.body.style.zoom = newZoom;
685
+ }
670
686
671
687
}
672
688
@@ -702,14 +718,14 @@ $(".draggable" ).draggable({ cursor: "move", snap: true , snapTolerance: 5, grid
702
718
<source src =" { $SCENE .VIDEO_WALLPAPER} " type =" video/mp4" >
703
719
</video >
704
720
{ /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 } ;" >
706
722
<div id =" scene_background_{ $SCENE .ID} " style =" position :relative ;" >
707
723
{ function name= elements}
708
724
{ foreach $items as $ELEMENT }
709
725
<!-- element { $ELEMENT .ID} -->
710
726
{ if isset($ELEMENT .ELEMENTS)}
711
727
<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 } "
713
729
style =" { if isset($ELEMENT .POSITION_TYPE) && $ELEMENT .POSITION_TYPE== " 0" } position :absolute ;left :{$ELEMENT.LEFT }px ;top :{$ELEMENT.TOP }px ;{/if }
714
730
{if isset ($ELEMENT .ZINDEX ) && $ELEMENT .ZINDEX != " " }z-index:{ $ELEMENT .ZINDEX} ;{ /if }
715
731
{ 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 ) {
832
848
833
849
{ foreach $ELEMENT .STATES as $STATE }
834
850
<div
835
- class =" element_{ $ELEMENT .ID}
851
+ class =" element_{ $ELEMENT .ID}
852
+ element_state
836
853
type_{ $ELEMENT .TYPE}
837
854
{ if $ELEMENT .CSS_STYLE!= " " } style_{ $ELEMENT .CSS_STYLE} { /if }
838
855
state_{ $STATE .TITLE}
@@ -874,7 +891,11 @@ function onDocumentMouseDown( event ) {
874
891
875
892
{ elements items= $SCENE .ELEMENTS}
876
893
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 }
878
899
</div >
879
900
</div >
880
901
{ if $TOTAL_SCENES != " 1" } </li >{ /if }
0 commit comments