Skip to content

Commit 1707cf0

Browse files
committed
Renamed getContextStyle and setContextStyle to getStyle and setStyle.
1 parent 95b17a5 commit 1707cf0

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

examples/css3d_sandbox.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
var element = document.createElement( 'div' );
7070
element.style.width = '100px';
7171
element.style.height = '100px';
72-
element.style.background = new THREE.Color( Math.random() * 0xffffff ).getContextStyle();
72+
element.style.background = new THREE.Color( Math.random() * 0xffffff ).getStyle();
7373

7474
var object = new THREE.CSS3DObject( element );
7575
object.position.x = Math.random() * 200 - 100;

examples/js/renderers/SVGRenderer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ THREE.SVGRenderer = function () {
328328

329329
if ( material instanceof THREE.LineBasicMaterial ) {
330330

331-
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + material.color.getContextStyle() + '; stroke-width: ' + material.linewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.linecap + '; stroke-linejoin: ' + material.linejoin );
331+
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + material.color.getStyle() + '; stroke-width: ' + material.linewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.linecap + '; stroke-linejoin: ' + material.linejoin );
332332

333333
_svg.appendChild( _svgNode );
334334

@@ -400,11 +400,11 @@ THREE.SVGRenderer = function () {
400400

401401
if ( material.wireframe ) {
402402

403-
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.getContextStyle() + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
403+
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.getStyle() + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
404404

405405
} else {
406406

407-
_svgNode.setAttribute( 'style', 'fill: ' + _color.getContextStyle() + '; fill-opacity: ' + material.opacity );
407+
_svgNode.setAttribute( 'style', 'fill: ' + _color.getStyle() + '; fill-opacity: ' + material.opacity );
408408

409409
}
410410

@@ -476,11 +476,11 @@ THREE.SVGRenderer = function () {
476476

477477
if ( material.wireframe ) {
478478

479-
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.getContextStyle() + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
479+
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.getStyle() + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
480480

481481
} else {
482482

483-
_svgNode.setAttribute( 'style', 'fill: ' + _color.getContextStyle() + '; fill-opacity: ' + material.opacity );
483+
_svgNode.setAttribute( 'style', 'fill: ' + _color.getStyle() + '; fill-opacity: ' + material.opacity );
484484

485485
}
486486

src/core/Color.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ THREE.Color.prototype = {
8181
break;
8282

8383
case "string":
84-
this.setContextStyle( value );
84+
this.setStyle( value );
8585
break;
8686

8787
}
@@ -185,13 +185,13 @@ THREE.Color.prototype = {
185185

186186
},
187187

188-
getContextStyle: function () {
188+
getStyle: function () {
189189

190190
return 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')';
191191

192192
},
193193

194-
setContextStyle: function ( style ) {
194+
setStyle: function ( style ) {
195195

196196
if ( /^rgb\((\d+),(\d+),(\d+)\)$/i.test( style ) ) {
197197

src/renderers/CanvasRenderer.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ THREE.CanvasRenderer = function ( parameters ) {
446446

447447
}
448448

449-
setFillStyle( material.color.getContextStyle() );
449+
setFillStyle( material.color.getStyle() );
450450

451451
_context.save();
452452
_context.translate( v1.x, v1.y );
@@ -511,8 +511,8 @@ THREE.CanvasRenderer = function ( parameters ) {
511511

512512
}
513513

514-
setStrokeStyle( material.color.getContextStyle() );
515-
setFillStyle( material.color.getContextStyle() );
514+
setStrokeStyle( material.color.getStyle() );
515+
setFillStyle( material.color.getStyle() );
516516

517517
_context.save();
518518
_context.translate( v1.x, v1.y );
@@ -541,7 +541,7 @@ THREE.CanvasRenderer = function ( parameters ) {
541541
setLineWidth( material.linewidth );
542542
setLineCap( material.linecap );
543543
setLineJoin( material.linejoin );
544-
setStrokeStyle( material.color.getContextStyle() );
544+
setStrokeStyle( material.color.getStyle() );
545545

546546
_context.stroke();
547547
_bboxRect.inflate( material.linewidth * 2 );
@@ -917,7 +917,7 @@ THREE.CanvasRenderer = function ( parameters ) {
917917
setLineWidth( linewidth );
918918
setLineCap( linecap );
919919
setLineJoin( linejoin );
920-
setStrokeStyle( color.getContextStyle() );
920+
setStrokeStyle( color.getStyle() );
921921

922922
_context.stroke();
923923

@@ -927,7 +927,7 @@ THREE.CanvasRenderer = function ( parameters ) {
927927

928928
function fillPath( color ) {
929929

930-
setFillStyle( color.getContextStyle() );
930+
setFillStyle( color.getStyle() );
931931
_context.fill();
932932

933933
}

0 commit comments

Comments
 (0)