Skip to content

Commit 14fbf7e

Browse files
committed
Merge remote-tracking branch 'sole/dev-build-python-less-than-2.7' into dev
2 parents 73dfc4e + f9b37da commit 14fbf7e

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

src/renderers/CanvasRenderer.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ THREE.CanvasRenderer = function ( parameters ) {
2929
_contextLineWidth = null,
3030
_contextLineCap = null,
3131
_contextLineJoin = null,
32+
_contextDashSize = null,
33+
_contextGapSize = 0,
3234

3335
_v1, _v2, _v3, _v4,
3436
_v5 = new THREE.RenderableVertex(),
@@ -89,6 +91,21 @@ THREE.CanvasRenderer = function ( parameters ) {
8991

9092
_gradientMapQuality --; // Fix UVs
9193

94+
// dash+gap fallbacks for Firefox and everything else
95+
if( ! _context.setLineDash ) {
96+
if( 'mozDash' in _context ) {
97+
_context.setLineDash = function( values ) {
98+
if( values[0] == null || values[1] == null) {
99+
_context.mozDash = null;
100+
} else {
101+
_context.mozDash = values;
102+
}
103+
}
104+
} else {
105+
_context.setLineDash = function( values ) {}
106+
}
107+
}
108+
92109
this.domElement = _canvas;
93110

94111
this.devicePixelRatio = parameters.devicePixelRatio !== undefined
@@ -573,6 +590,18 @@ THREE.CanvasRenderer = function ( parameters ) {
573590
setLineCap( material.linecap );
574591
setLineJoin( material.linejoin );
575592
setStrokeStyle( material.color.getStyle() );
593+
setDashAndGap( null, null );
594+
595+
_context.stroke();
596+
_elemBox.expandByScalar( material.linewidth * 2 );
597+
598+
} else if ( material instanceof THREE.LineDashedMaterial ) {
599+
600+
setLineWidth( material.linewidth );
601+
setLineCap( material.linecap );
602+
setLineJoin( material.linejoin );
603+
setStrokeStyle( material.color.getStyle() );
604+
setDashAndGap( material.dashSize, material.gapSize );
576605

577606
_context.stroke();
578607
_elemBox.expandByScalar( material.linewidth * 2 );
@@ -1260,4 +1289,16 @@ THREE.CanvasRenderer = function ( parameters ) {
12601289

12611290
}
12621291

1292+
function setDashAndGap( dashSizeValue, gapSizeValue ) {
1293+
1294+
if( _contextDashSize !== dashSizeValue || _contextGapSize !== gapSizeValue ) {
1295+
1296+
_context.setLineDash([ dashSizeValue, gapSizeValue ]);
1297+
_contextDashSize = dashSizeValue;
1298+
_contextGapSize = gapSizeValue;
1299+
1300+
}
1301+
1302+
}
1303+
12631304
};

utils/build.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#!/usr/bin/env python
22

3+
import sys
4+
5+
if sys.version_info < (2, 7):
6+
print("ERROR: The build script requires Python 2.7 or higher.")
7+
print("You can get an updated version here: http://www.python.org/download/releases/")
8+
exit()
9+
10+
311
import argparse
412
import json
513
import os
614
import shutil
7-
import sys
815
import tempfile
916

1017

0 commit comments

Comments
 (0)