Permalink
Browse files

fix position relative bug and reset ext on clear

  • Loading branch information...
1 parent ee5d855 commit 989e8d717f0de7f542440bea2324576982c45299 @mojombo committed Oct 25, 2008
Showing with 13 additions and 2 deletions.
  1. +7 −2 primer.js
  2. +1 −0 test/test.html
  3. +5 −0 test/text_test.html
View
@@ -13,12 +13,16 @@ Primer.prototype = {
$("html head").append("<style>.primer_text { margin: 0; padding: 0; line-height: normal; }</style>")
var el = $(this.container).eq(0)
- el.css("position", "relative")
+
+ el.append('<div id="primer_text"></div>')
+ var tel = $("#primer_text", el).eq(0)
+ tel.css("position", "relative")
+ this.element = tel
+
el.append('<canvas width="' + this.width + '" height="' + this.height + '"></canvas>')
var jelc = $('canvas', el)
var elc = jelc[0]
this.context = elc.getContext('2d')
- this.element = el
this.root = new Primer.Layer()
this.root.bind(this)
@@ -62,6 +66,7 @@ Primer.prototype = {
draw: function() {
this.context.clearRect(0, 0, this.width, this.height)
$(".primer_text", this.element).remove()
+ this.setupExt()
this.root.draw()
},
View
@@ -59,6 +59,7 @@
</script>
</head>
<body>
+ <p>Testing</p>
<div id="p1"></div>
</body>
</html>
View
@@ -25,6 +25,11 @@
bye.fillStyle = "#FF0000"
bye.fillText("goodbye, suckers!", 10, 50, 150)
hello.addChild(bye)
+
+ var box = new Primer.Layer()
+ box.fillStyle = "#CCCCFF"
+ box.fillRect(10, 10, 70, 70)
+ p1.addChild(box)
})
</script>
</head>

0 comments on commit 989e8d7

Please sign in to comment.