Subversion Repository Public Repository

Nextrek

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
tyrano.base ={
    
    //読み込み対象のモジュール
    tyrano:null,
    modules:[],
    options:{
        
    },
    
    init:function(tyrano){
        this.tyrano = tyrano;
    },
    
    setBaseSize:function(width,height){
        
        this.tyrano.get(".tyrano_base").css("width",width).css("height",height).css("background-color","black");
        
        //NW.js 以外の場合。absolute
        if(!$.isNWJS()){
            $(".tyrano_base").css("position","absolute");
        }
        
    },
    
    //画面サイズをぴったりさせます
    fitBaseSize:function(width,height){
       
        var that = this;
      	var view_width = $.getViewPort().width;
        var view_height = $.getViewPort().height;
        
        var width_f = view_width / width ;
        var height_f = view_height / height;
        
        var scale_f = 0;
        
        var space_width = 0;
        
        var screen_ratio = this.tyrano.kag.config.ScreenRatio;
        
        //比率を固定にしたい場合は以下 以下のとおりになる
        if(screen_ratio =="fix"){
        	
        	if(width_f > height_f){
               scale_f = height_f;
             }else{
                scale_f = width_f;
        	}
        	
        	this.tyrano.kag.tmp.base_scale = scale_f;

            setTimeout(function() {
                    
                   //中央寄せなら、画面サイズ分を引く。
                   if(that.tyrano.kag.config["ScreenCentering"] && that.tyrano.kag.config["ScreenCentering"]=="true"){
                       
                       $(".tyrano_base").css("transform-origin","0 0");
                       $(".tyrano_base").css({
                           margin: 0
                       });
                       
                       var width = Math.abs(parseInt(window.innerWidth) - parseInt(that.tyrano.kag.config.scWidth*scale_f))/2;
                       var height = Math.abs(parseInt(window.innerHeight) - parseInt(that.tyrano.kag.config.scHeight*scale_f))/2;
                       
                       if(width_f > height_f){
                            $(".tyrano_base").css("left",width+"px");
                            $(".tyrano_base").css("top","0px");
                       }else{
                            
                            $(".tyrano_base").css("left","0px");
                            $(".tyrano_base").css("top",height+"px");
                            
                       }
                       
                   }
                   
                   $(".tyrano_base").css("transform", "scale(" + scale_f + ") ");
                   if (parseInt(view_width) < parseInt(width)) {
                        if (scale_f < 1) {
                            window.scrollTo(width, height);
                        }
                   }

            }, 100);        	
            
        }else if(screen_ratio =="fit"){
            
            //スクリーンサイズに合わせて自動的に調整される
            setTimeout(function() {
                       $(".tyrano_base").css("transform","scaleX("+width_f+") scaleY("+height_f+")");
                       window.scrollTo(width, height);
            },100);
            
        }else{
        	
        	//スクリーンサイズ固定
        	
        }
       
        
    },
    
    test:function(){
        //alert("tyrano test");
    }
    
};

Commits for Nextrek/FurryHouse/tyrano/tyrano.base.js

Diff revisions: vs.
Revision Author Commited Message
1361 DBraccini picture DBraccini Mon 30 Mar, 2020 13:31:12 +0000