Merge pull request #6285 from Snuffleupagus/rename-PatternType-to-ShadingType
Rename `PatternType` to `ShadingType` to avoid confusion
This commit is contained in:
commit
31456a5b6d
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var PatternType = {
|
var ShadingType = {
|
||||||
FUNCTION_BASED: 1,
|
FUNCTION_BASED: 1,
|
||||||
AXIAL: 2,
|
AXIAL: 2,
|
||||||
RADIAL: 3,
|
RADIAL: 3,
|
||||||
@ -52,17 +52,17 @@ var Pattern = (function PatternClosure() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PatternType.AXIAL:
|
case ShadingType.AXIAL:
|
||||||
case PatternType.RADIAL:
|
case ShadingType.RADIAL:
|
||||||
// Both radial and axial shadings are handled by RadialAxial shading.
|
// Both radial and axial shadings are handled by RadialAxial shading.
|
||||||
return new Shadings.RadialAxial(dict, matrix, xref, res);
|
return new Shadings.RadialAxial(dict, matrix, xref, res);
|
||||||
case PatternType.FREE_FORM_MESH:
|
case ShadingType.FREE_FORM_MESH:
|
||||||
case PatternType.LATTICE_FORM_MESH:
|
case ShadingType.LATTICE_FORM_MESH:
|
||||||
case PatternType.COONS_PATCH_MESH:
|
case ShadingType.COONS_PATCH_MESH:
|
||||||
case PatternType.TENSOR_PATCH_MESH:
|
case ShadingType.TENSOR_PATCH_MESH:
|
||||||
return new Shadings.Mesh(shading, matrix, xref, res);
|
return new Shadings.Mesh(shading, matrix, xref, res);
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown PatternType: ' + type);
|
throw new Error('Unsupported ShadingType: ' + type);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex instanceof MissingDataException) {
|
if (ex instanceof MissingDataException) {
|
||||||
@ -110,7 +110,7 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
|
|||||||
extendEnd = extendArr[1];
|
extendEnd = extendArr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.shadingType === PatternType.RADIAL &&
|
if (this.shadingType === ShadingType.RADIAL &&
|
||||||
(!extendStart || !extendEnd)) {
|
(!extendStart || !extendEnd)) {
|
||||||
// Radial gradient only currently works if either circle is fully within
|
// Radial gradient only currently works if either circle is fully within
|
||||||
// the other circle.
|
// the other circle.
|
||||||
@ -185,13 +185,13 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
|
|||||||
var coordsArr = this.coordsArr;
|
var coordsArr = this.coordsArr;
|
||||||
var shadingType = this.shadingType;
|
var shadingType = this.shadingType;
|
||||||
var type, p0, p1, r0, r1;
|
var type, p0, p1, r0, r1;
|
||||||
if (shadingType === PatternType.AXIAL) {
|
if (shadingType === ShadingType.AXIAL) {
|
||||||
p0 = [coordsArr[0], coordsArr[1]];
|
p0 = [coordsArr[0], coordsArr[1]];
|
||||||
p1 = [coordsArr[2], coordsArr[3]];
|
p1 = [coordsArr[2], coordsArr[3]];
|
||||||
r0 = null;
|
r0 = null;
|
||||||
r1 = null;
|
r1 = null;
|
||||||
type = 'axial';
|
type = 'axial';
|
||||||
} else if (shadingType === PatternType.RADIAL) {
|
} else if (shadingType === ShadingType.RADIAL) {
|
||||||
p0 = [coordsArr[0], coordsArr[1]];
|
p0 = [coordsArr[0], coordsArr[1]];
|
||||||
p1 = [coordsArr[3], coordsArr[4]];
|
p1 = [coordsArr[3], coordsArr[4]];
|
||||||
r0 = coordsArr[2];
|
r0 = coordsArr[2];
|
||||||
@ -732,19 +732,19 @@ Shadings.Mesh = (function MeshClosure() {
|
|||||||
|
|
||||||
var patchMesh = false;
|
var patchMesh = false;
|
||||||
switch (this.shadingType) {
|
switch (this.shadingType) {
|
||||||
case PatternType.FREE_FORM_MESH:
|
case ShadingType.FREE_FORM_MESH:
|
||||||
decodeType4Shading(this, reader);
|
decodeType4Shading(this, reader);
|
||||||
break;
|
break;
|
||||||
case PatternType.LATTICE_FORM_MESH:
|
case ShadingType.LATTICE_FORM_MESH:
|
||||||
var verticesPerRow = dict.get('VerticesPerRow') | 0;
|
var verticesPerRow = dict.get('VerticesPerRow') | 0;
|
||||||
assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
|
assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
|
||||||
decodeType5Shading(this, reader, verticesPerRow);
|
decodeType5Shading(this, reader, verticesPerRow);
|
||||||
break;
|
break;
|
||||||
case PatternType.COONS_PATCH_MESH:
|
case ShadingType.COONS_PATCH_MESH:
|
||||||
decodeType6Shading(this, reader);
|
decodeType6Shading(this, reader);
|
||||||
patchMesh = true;
|
patchMesh = true;
|
||||||
break;
|
break;
|
||||||
case PatternType.TENSOR_PATCH_MESH:
|
case ShadingType.TENSOR_PATCH_MESH:
|
||||||
decodeType7Shading(this, reader);
|
decodeType7Shading(this, reader);
|
||||||
patchMesh = true;
|
patchMesh = true;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user