チェンジセット 1517

差分発生行の前後
無視リスト:
コミット日時:
2008/10/05 05:34:33 (3 年前)
コミッタ:
gyuque
ログメッセージ:

0.4.4: mousedown handler, _width/_height

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • ruby/jsplash/trunk/client2/index.xml

    r1499 r1517  
    5454                <div id="progbar"><div>  </div></div> 
    5555                <p id="statusout"> </p> 
    56                 <p id="sout"><em>JSplash Player</em> 0.4.3<br />-------------------------------------<br /></p> 
     56                <p id="sout"><em>JSplash Player</em> 0.4.4<br />-------------------------------------<br /></p> 
    5757                <svg id="svgrt" xmlns="http://www.w3.org/2000/svg" style="width: 100px; height: 100px;"> 
    5858                </svg> 
  • ruby/jsplash/trunk/client2/jsplash/executor.js

    r1499 r1517  
    114114                                mobj.doEnterFrame(); 
    115115                } 
    116          
     116 
     117                JSplash.gPlayer.stage.leaveFrame(); 
    117118//////////////////////////////////// debug 
    118119                { 
  • ruby/jsplash/trunk/client2/jsplash/objects.js

    r1495 r1517  
    3939                this.appended = false; 
    4040                this.shape_disposed = false; 
     41 
     42                this.mousePos = {x:0, y:0}; 
    4143 
    4244                this.framePersists = {}; 
     
    339341                if (!skip_visual_change)         
    340342                        this.hideClippers(); 
     343 
     344                if (this.g && this.g.childNodes.length > 0) 
     345                        this.updateProxy(); 
    341346        }, 
    342347         
     
    399404 
    400405        doEnterFrame: function() { 
     406                if (!this.klass) 
     407                        return; 
     408                var vlist = this.klass.getVarList(); 
     409 
    401410                var handler = this.getProxy().onEnterFrame; 
    402                 if (handler && this.klass) { 
     411                if (handler) { 
    403412                 
    404413                        if (!handler._ai_) 
    405414                                handler._ai_ = new JSplash.ActionInstance(handler); 
    406415                         
    407                         this.execScript(handler._ai_, this.klass.getVarList(), this.getProxy().onEnterFrame_env); 
     416                        this.execScript(handler._ai_, vlist, this.getProxy().onEnterFrame_env); 
     417                } 
     418 
     419                // next, check mousedown 
     420                if (JSplash.gPlayer.stage.mouse_down) { 
     421                        handler = this.getProxy().onMouseDown; 
     422                        if (handler) { 
     423                                if (!handler._ai_) 
     424                                        handler._ai_ = new JSplash.ActionInstance(handler); 
     425 
     426                                this.execScript(handler._ai_, vlist); 
     427                        } 
    408428                } 
    409429        }, 
     
    551571                P._yscale = T.sy * 100.0; 
    552572                P._rotation = T.r; 
     573 
     574                P._xmouse = this.mousePos.x; 
     575                P._ymouse = this.mousePos.y; 
     576 
     577                this.putViewSize(P); 
     578        }, 
     579 
     580        putViewSize: function(P) { 
     581                if (JSplash._bbox_implemented) { 
     582                        try { 
     583                                var b = this.g.getBBox(); 
     584                                P._width  = b.width; 
     585                                P._height = b.height; 
     586                        } catch(e) { 
     587                                console.warn("This browser does not support SVG bounding box completely."); 
     588                                JSplash._bbox_implemented = false; 
     589                        } 
     590                } 
    553591        }, 
    554592         
     
    588626        var s = new JSplash.ObjectInstance(taglist, null, g); 
    589627        s.label_map = label_map; 
     628        s.mouse_down = false; 
    590629         
    591630        Object.extend(s, { 
    592631                registry: {}, 
     632 
     633                leaveFrame: function() { 
     634                        this.mouse_down = false; 
     635                }, 
     636 
     637                setMouseDown: function() { 
     638                        this.mouse_down = true; 
     639                }, 
     640 
     641                setMousePos: function(x, y) { 
     642                        this.mousePos.x = x; 
     643                        this.mousePos.y = y; 
     644                        var P = this.getProxy(); 
     645                        P._xmouse = x; 
     646                        P._ymouse = y; 
     647                }, 
    593648         
    594649                setBackgroundColor: function(rgb) { 
     
    678733                if (!this.onEnterFrame) 
    679734                        this.onEnterFrame = null; 
     735                if (!this.onMouseDown) 
     736                        this.onMouseDown = null; 
    680737        }, 
    681738         
  • ruby/jsplash/trunk/client2/jsplash/player.js

    r1494 r1517  
    1 var JSplash = {swfdata: null, gPlayer: null}; 
     1var JSplash = {swfdata: null, gPlayer: null, _bbox_implemented: true}; 
    22if (!window.console) 
    33        window.console = {log:function(){}, warn:function(){}}; 
     
    2828                } 
    2929                 
     30                svg.addEventListener("mousemove", this.onTopMouseMove.bind(this, svg), false); 
     31                svg.addEventListener("mousedown", this.onTopMouseDown.bind(this), false); 
     32 
    3033                JSplash.SWFGlobals.setup(this); 
    3134                this.doInitActions(); 
     
    4447                 
    4548                delete Object.prototype.addProperty; 
     49        }, 
     50 
     51        onTopMouseDown: function(e) { 
     52                if (Event.isLeftClick(e)) 
     53                        this.stage.setMouseDown(); 
     54        }, 
     55 
     56        onTopMouseMove: function(svg, e) { 
     57                var x, y; 
     58                if (e.offsetX) { 
     59                        x = e.offsetX; 
     60                        y = e.offsetY; 
     61                } 
     62                else { 
     63                        x = e.layerX; 
     64                        y = e.layerY; 
     65                } 
     66 
     67                this.stage.setMousePos(x, y); 
    4668        }, 
    4769