[Sie-announce] SIEコード [1722] SVGSVGElementと、そのgetScreenCTMメソッドの修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 3月 11日 (木) 20:11:19 JST


Revision: 1722
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1722
Author:   dhrname
Date:     2010-03-11 20:11:19 +0900 (Thu, 11 Mar 2010)

Log Message:
-----------
SVGSVGElementと、そのgetScreenCTMメソッドの修正

Modified Paths:
--------------
    branches/ufltima/dom/svg.js

Modified: branches/ufltima/dom/svg.js
===================================================================
--- branches/ufltima/dom/svg.js	2010-03-11 11:10:37 UTC (rev 1721)
+++ branches/ufltima/dom/svg.js	2010-03-11 11:11:19 UTC (rev 1722)
@@ -783,13 +783,17 @@
   /*readonly SVGAnimatedRect*/   this.viewBox = this.currentView.viewBox;
   /*readonly SVGAnimatedPreserveAspectRatio*/ this.preserveAspectRatio = this.currentView.preserveAspectRatio;
   /*unsigned short*/             this.zoomAndPan = SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE;
+  this._tx = 0;
+  this._ty = 0;
   /*DOMAttrModifiedイベントを利用して、
    *随時、属性の値をDOMプロパティに変換しておくリスナー登録
    */
   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
-    var ttps =  evt.target._tar.style;
-    ttps.marginLeft = this._tx+ "px";
-    ttps.marginTop = this._ty+ "px";
+    var tar = evt.target;
+    tar.getScreenCTM(); //this._tx, _tyプロパティを設定するために呼び出す
+    var ttps =  tar._tar.style;
+    ttps.marginLeft = tar._tx+ "px";
+    ttps.marginTop = tar._ty+ "px";
   }, false);
   return this;
 };
@@ -834,9 +838,12 @@
   s.setMatrix(matrix);
   return s;
 };
-/*SVGMatrix*/ SVGElement.prototype.getScreenCTM = function(){
+/*getScreenCTM
+ *SVGElement(SVGLocatable)で指定しておいたメソッドであるが、ここで、算出方法が違うため、再定義をする
+ */
+/*SVGMatrix*/ SVGSVGElement.prototype.getScreenCTM = function(){
   var vw = this.viewport.width, vh = this.viewport.height;
-  var vB = this.currentView.viewBox, par = this.currentView.preserveAspectRatio;
+  var vB = this.currentView.viewBox.baseVal, par = this.currentView.preserveAspectRatio.baseVal;
   if (!vB) {
     this._tx = this._ty = 0;
     return this.createSVGMatrix();




Sie-announce メーリングリストの案内
Back to archive index