Parcourir la source

Get style with context

tentone il y a 5 ans
Parent
commit
624d62af48

+ 2 - 2
source/objects/Box.js

@@ -70,14 +70,14 @@ Box.prototype.draw = function(context, viewport, canvas)
 
 	if(this.fillStyle !== null)
 	{	
-		context.fillStyle = this.fillStyle.get();
+		context.fillStyle = this.fillStyle.get(context);
 		context.fillRect(this.box.min.x, this.box.min.y, width, height);
 	}
 
 	if(this.strokeStyle !== null)
 	{
 		context.lineWidth = this.lineWidth;
-		context.strokeStyle = this.strokeStyle.get();
+		context.strokeStyle = this.strokeStyle.get(context);
 		context.strokeRect(this.box.min.x, this.box.min.y, width, height);
 	}
 };

+ 2 - 2
source/objects/Circle.js

@@ -72,14 +72,14 @@ Circle.prototype.draw = function(context, viewport, canvas)
 	
 	if(this.fillStyle !== null)
 	{	
-		context.fillStyle = this.fillStyle.get();
+		context.fillStyle = this.fillStyle.get(context);
 		context.fill();
 	}
 
 	if(this.strokeStyle !== null)
 	{
 		context.lineWidth = this.lineWidth;
-		context.strokeStyle = this.strokeStyle.get();
+		context.strokeStyle = this.strokeStyle.get(context);
 		context.stroke();
 	}
 };

+ 1 - 1
source/objects/Line.js

@@ -67,7 +67,7 @@ Object2D.register(Line, "Line");
 Line.prototype.style = function(context, viewport, canvas)
 {
 	context.lineWidth = this.lineWidth;
-	context.strokeStyle = this.strokeStyle.get();
+	context.strokeStyle = this.strokeStyle.get(context);
 	context.setLineDash(this.dashPattern);
 };
 

+ 2 - 2
source/objects/MultiLineText.js

@@ -83,13 +83,13 @@ MultiLineText.prototype.draw = function(context, viewport, canvas)
 		{
 			if(this.fillStyle !== null)
 			{
-				context.fillStyle = this.fillStyle.get();
+				context.fillStyle = this.fillStyle.get(context);
 				context.fillText(sublines[j], this.position.x, this.position.y + offsetY);
 			}
 
 			if(this.strokeStyle !== null)
 			{
-				context.strokeStyle = this.strokeStyle.get();
+				context.strokeStyle = this.strokeStyle.get(context);
 				context.strokeText(sublines[j], this.position.x, this.position.y + offsetY);
 			}
 

+ 2 - 2
source/objects/RoundedBox.js

@@ -56,7 +56,7 @@ RoundedBox.prototype.draw = function(context, viewport, canvas)
 
 	if(this.fillStyle !== null)
 	{	
-		context.fillStyle = this.fillStyle.get();
+		context.fillStyle = this.fillStyle.get(context);
 		RoundedBox.roundRect(context, this.box.min.x, this.box.min.y, width, height, this.radius);
 		context.fill();
 	}
@@ -64,7 +64,7 @@ RoundedBox.prototype.draw = function(context, viewport, canvas)
 	if(this.strokeStyle !== null)
 	{
 		context.lineWidth = this.lineWidth;
-		context.strokeStyle = this.strokeStyle.get();
+		context.strokeStyle = this.strokeStyle.get(context);
 		RoundedBox.roundRect(context, this.box.min.x, this.box.min.y, width, height, this.radius);
 		context.stroke();
 	}

+ 2 - 2
source/objects/Text.js

@@ -80,13 +80,13 @@ Text.prototype.draw = function(context, viewport, canvas)
 	
 	if(this.fillStyle !== null)
 	{
-		context.fillStyle = this.fillStyle.get();
+		context.fillStyle = this.fillStyle.get(context);
 		context.fillText(this.text, 0, 0);
 	}
 
 	if(this.strokeStyle !== null)
 	{
-		context.strokeStyle = this.strokeStyle.get();
+		context.strokeStyle = this.strokeStyle.get(context);
 		context.strokeText(this.text, 0, 0);
 	}
 };