diff --git a/.eslintrc.js b/.eslintrc.js index 4b4ea47794d..51d0abb48d4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,6 +19,7 @@ module.exports = { // Not for us ;-) 'jsx-a11y/label-has-for': 0, 'no-console': 0, + 'no-plusplus': 0, // Not for vtk.js 'import/no-named-as-default': 0, diff --git a/Sources/Common/Core/Math/index.js b/Sources/Common/Core/Math/index.js index 2b62af56f6f..3d447a21c6b 100644 --- a/Sources/Common/Core/Math/index.js +++ b/Sources/Common/Core/Math/index.js @@ -1,12 +1,13 @@ // ---------------------------------------------------------------------------- /* eslint-disable camelcase */ /* eslint-disable no-cond-assign */ +/* eslint-disable no-bitwise */ // ---------------------------------------------------------------------------- const VTK_MAX_ROTATIONS = 20; const VTK_SMALL_NUMBER = 1.0e-12; function notImplemented(method) { - return () => console.log('vtkMath::${method} - NOT IMPLEMENTED'); + return () => console.log(`vtkMath::${method} - NOT IMPLEMENTED`); } function vtkSwapVectors3(v1, v2) { diff --git a/Sources/Common/DataModel/BoundingBox/index.js b/Sources/Common/DataModel/BoundingBox/index.js index 4446c77d459..5c976397074 100644 --- a/Sources/Common/DataModel/BoundingBox/index.js +++ b/Sources/Common/DataModel/BoundingBox/index.js @@ -105,7 +105,7 @@ function vtkBoundingBox(publicAPI, model) { /* eslint-enable no-use-before-define */ }; - publicAPI.equals = other => { + publicAPI.equals = (other) => { const a = model.bounds; const b = other.getBounds(); return a[0] === b[0] @@ -164,13 +164,13 @@ function vtkBoundingBox(publicAPI, model) { ]; }; - publicAPI.addBox = other => { + publicAPI.addBox = (other) => { publicAPI.addBounds(...other.getBounds()); }; publicAPI.isValid = () => isValid(model.bounds); - publicAPI.intersect = bbox => { + publicAPI.intersect = (bbox) => { if (!(publicAPI.isValid() && bbox.isValid())) { return false; } @@ -210,7 +210,7 @@ function vtkBoundingBox(publicAPI, model) { return true; }; - publicAPI.intersects = bbox => { + publicAPI.intersects = (bbox) => { if (!(publicAPI.isValid() && bbox.isValid())) { return false; } @@ -326,7 +326,7 @@ function vtkBoundingBox(publicAPI, model) { publicAPI.getMaxPoint = () => [model.bounds[1], model.bounds[3], model.bounds[5]]; publicAPI.getBound = index => model.bound[index]; - publicAPI.contains = bbox => { + publicAPI.contains = (bbox) => { // if either box is not valid or they don't intersect if (!publicAPI.intersects(bbox)) { return false; @@ -351,7 +351,7 @@ function vtkBoundingBox(publicAPI, model) { publicAPI.reset = () => publicAPI.setBounds([].concat(INIT_BOUNDS)); - publicAPI.inflate = delta => { + publicAPI.inflate = (delta) => { model.bounds = model.bounds.map((value, index) => { if (index % 2 === 0) { return value - delta; diff --git a/Sources/Common/DataModel/DataSetAttributes/index.js b/Sources/Common/DataModel/DataSetAttributes/index.js index 346bc9e8ebc..7406e2fb703 100644 --- a/Sources/Common/DataModel/DataSetAttributes/index.js +++ b/Sources/Common/DataModel/DataSetAttributes/index.js @@ -63,7 +63,7 @@ function vtkDataSetAttributes(publicAPI, model) { return null; }; - publicAPI.addArray = array => { + publicAPI.addArray = (array) => { if (model.arrays[array.getName()]) { throw new Error('Array with same name already exist', array, model.arrays); } @@ -84,7 +84,7 @@ function vtkDataSetAttributes(publicAPI, model) { // Process dataArrays if any if (model.dataArrays && Object.keys(model.dataArrays).length) { - Object.keys(model.dataArrays).forEach(name => { + Object.keys(model.dataArrays).forEach((name) => { if (!model.dataArrays[name].ref && model.dataArrays[name].type === 'vtkDataArray') { publicAPI.addArray(vtkDataArray.newInstance(model.dataArrays[name])); } @@ -97,7 +97,7 @@ function vtkDataSetAttributes(publicAPI, model) { const copyInst = newInstance(newIntsanceModel); // Shallow copy each array - publicAPI.getArrayNames().forEach(name => { + publicAPI.getArrayNames().forEach((name) => { copyInst.addArray(publicAPI.getArray(name).shallowCopy()); }); diff --git a/Sources/Common/DataModel/PolyData/index.js b/Sources/Common/DataModel/PolyData/index.js index c0920958f35..b2f787dbfa3 100644 --- a/Sources/Common/DataModel/PolyData/index.js +++ b/Sources/Common/DataModel/PolyData/index.js @@ -27,7 +27,7 @@ function vtkPolyData(publicAPI, model) { } // build empty cell arrays and set methods - ['Verts', 'Lines', 'Polys', 'Strips'].forEach(type => { + ['Verts', 'Lines', 'Polys', 'Strips'].forEach((type) => { const lowerType = type.toLowerCase(); // Don't create array if already available if (model[lowerType]) { @@ -50,7 +50,7 @@ function vtkPolyData(publicAPI, model) { ]; // Start to shallow copy each piece - fieldList.forEach(field => { + fieldList.forEach((field) => { modelInstance[field] = model[field].shallowCopy(); }); diff --git a/Sources/Filters/Sources/ConeSource/index.js b/Sources/Filters/Sources/ConeSource/index.js index 03f40c3fb70..92dbf87071f 100644 --- a/Sources/Filters/Sources/ConeSource/index.js +++ b/Sources/Filters/Sources/ConeSource/index.js @@ -44,10 +44,10 @@ export function vtkConeSource(publicAPI, model) { }; // Add parameter used to create dataset as metadata.state[*] - ['height', 'radius', 'resolution', 'capping'].forEach(field => { + ['height', 'radius', 'resolution', 'capping'].forEach((field) => { state[field] = model[field]; }); - ['center', 'direction'].forEach(field => { + ['center', 'direction'].forEach((field) => { state[field] = [].concat(model[field]); }); diff --git a/Sources/Filters/Sources/SphereSource/index.js b/Sources/Filters/Sources/SphereSource/index.js index 39513123f64..be54cad8b06 100644 --- a/Sources/Filters/Sources/SphereSource/index.js +++ b/Sources/Filters/Sources/SphereSource/index.js @@ -51,10 +51,10 @@ export function vtkSphereSource(publicAPI, model) { }; // Add parameter used to create dataset as metadata.state[*] - ['radius', 'latLongTessellation', 'thetaResolution', 'startTheta', 'endTheta', 'phiResolution', 'startPhi', 'endPhi'].forEach(field => { + ['radius', 'latLongTessellation', 'thetaResolution', 'startTheta', 'endTheta', 'phiResolution', 'startPhi', 'endPhi'].forEach((field) => { state[field] = model[field]; }); - ['center'].forEach(field => { + ['center'].forEach((field) => { state[field] = [].concat(model[field]); }); diff --git a/Sources/IO/Core/HttpDataSetReader/index.js b/Sources/IO/Core/HttpDataSetReader/index.js index c4fe203863a..458c04506cc 100644 --- a/Sources/IO/Core/HttpDataSetReader/index.js +++ b/Sources/IO/Core/HttpDataSetReader/index.js @@ -16,7 +16,7 @@ const GEOMETRY_ARRAYS = { vtkPolyData(dataset) { const arrayToDownload = []; arrayToDownload.push(dataset.vtkPolyData.Points); - Object.keys(dataset.vtkPolyData).forEach(cellName => { + Object.keys(dataset.vtkPolyData).forEach((cellName) => { if (dataset.vtkPolyData[cellName]) { arrayToDownload.push(dataset.vtkPolyData[cellName]); } @@ -49,7 +49,7 @@ const GEOMETRY_ARRAYS = { vtkMultiBlock(dataset) { let arrayToDownload = []; - Object.keys(dataset.vtkMultiBlock.Blocks).forEach(blockName => { + Object.keys(dataset.vtkMultiBlock.Blocks).forEach((blockName) => { const fn = GEOMETRY_ARRAYS[dataset.vtkMultiBlock.Blocks[blockName].type]; if (fn) { arrayToDownload = [].concat(arrayToDownload, fn(dataset.vtkMultiBlock.Blocks[blockName])); @@ -79,7 +79,7 @@ export function vtkHttpDataSetReader(publicAPI, model) { const xhr = new XMLHttpRequest(); const url = [model.baseURL, array.ref.basepath, fetchGzip ? `${array.ref.id}.gz` : array.ref.id].join('/'); - xhr.onreadystatechange = e => { + xhr.onreadystatechange = (e) => { if (xhr.readyState === 1) { array.ref.pending = true; if (++model.requestCount === 1) { @@ -143,7 +143,7 @@ export function vtkHttpDataSetReader(publicAPI, model) { // Internal method to fill block information and state function fillBlocks(dataset, block, arraysToList, enable) { if (dataset.type === 'vtkMultiBlock') { - Object.keys(dataset.MultiBlock.Blocks).forEach(blockName => { + Object.keys(dataset.MultiBlock.Blocks).forEach((blockName) => { block[blockName] = fillBlocks(dataset.MultiBlock.Blocks[blockName], {}, arraysToList, enable); block[blockName].enable = enable; }); @@ -151,9 +151,9 @@ export function vtkHttpDataSetReader(publicAPI, model) { block.type = dataset.type; block.enable = enable; const container = dataset[dataset.type]; - LOCATIONS.forEach(location => { + LOCATIONS.forEach((location) => { if (container[location]) { - Object.keys(container[location]).forEach(name => { + Object.keys(container[location]).forEach((name) => { if (arraysToList[`${location}_:|:_${name}`]) { arraysToList[`${location}_:|:_${name}`].ds.push(container); } else { @@ -176,7 +176,7 @@ export function vtkHttpDataSetReader(publicAPI, model) { // Find corresponding datasetBlock if (root.MultiBlock && root.MultiBlock.Blocks) { - Object.keys(root.MultiBlock.Blocks).forEach(blockName => { + Object.keys(root.MultiBlock.Blocks).forEach((blockName) => { if (enable) { return; } @@ -203,7 +203,7 @@ export function vtkHttpDataSetReader(publicAPI, model) { const xhr = new XMLHttpRequest(); let dataset = model.dataset; - xhr.onreadystatechange = e => { + xhr.onreadystatechange = (e) => { if (xhr.readyState === 1) { if (++model.requestCount === 1) { publicAPI.invokeBusy(true); @@ -227,14 +227,14 @@ export function vtkHttpDataSetReader(publicAPI, model) { model.blocks = {}; const arraysToList = {}; fillBlocks(dataset, model.blocks, arraysToList, enable); - Object.keys(arraysToList).forEach(id => { + Object.keys(arraysToList).forEach((id) => { model.arrays.push(arraysToList[id]); }); } else { // Regular dataset - LOCATIONS.forEach(location => { + LOCATIONS.forEach((location) => { if (container[location]) { - Object.keys(container[location]).forEach(name => { + Object.keys(container[location]).forEach((name) => { model.arrays.push({ name, enable, location, ds: [container] }); }); } @@ -243,7 +243,7 @@ export function vtkHttpDataSetReader(publicAPI, model) { // Fetch geometry arrays const pendingPromises = []; - GEOMETRY_ARRAYS[dataset.type](dataset).forEach(array => { + GEOMETRY_ARRAYS[dataset.type](dataset).forEach((array) => { pendingPromises.push(fetchArray(array, model.fetchGzip)); }); @@ -251,11 +251,11 @@ export function vtkHttpDataSetReader(publicAPI, model) { if (pendingPromises.length) { Promise.all(pendingPromises) .then( - ok => { + (ok) => { model.output[0] = vtk(dataset); resolve(publicAPI, model.output[0]); }, - err => { + (err) => { reject(err); } ); @@ -276,7 +276,7 @@ export function vtkHttpDataSetReader(publicAPI, model) { }); // Set DataSet url - publicAPI.setUrl = url => { + publicAPI.setUrl = (url) => { if (url.indexOf('index.json') === -1) { model.baseURL = url; model.url = `${url}/index.json`; @@ -301,8 +301,8 @@ export function vtkHttpDataSetReader(publicAPI, model) { const arrayMappingFunc = []; model.arrays .filter(array => array.enable) - .forEach(array => { - array.ds.forEach(ds => { + .forEach((array) => { + array.ds.forEach((ds) => { if (isDatasetEnable(datasetStruct, model.blocks, ds)) { if (ds[array.location][array.name].ref) { arrayToFecth.push(ds[array.location][array.name]); diff --git a/Sources/Rendering/Core/Camera/index.js b/Sources/Rendering/Core/Camera/index.js index 1497eea35b4..f8d35e1e32b 100644 --- a/Sources/Rendering/Core/Camera/index.js +++ b/Sources/Rendering/Core/Camera/index.js @@ -72,7 +72,7 @@ function vtkCamera(publicAPI, model) { publicAPI.modified(); }; - publicAPI.setDistance = d => { + publicAPI.setDistance = (d) => { // if (distance === d) { // return; // } @@ -142,7 +142,7 @@ function vtkCamera(publicAPI, model) { // Move the position of the camera along the view plane normal. Moving // towards the focal point (e.g., > 1) is a dolly-in, moving away // from the focal point (e.g., < 1) is a dolly-out. - publicAPI.dolly = amount => { + publicAPI.dolly = (amount) => { if (amount <= 0.0) { return; } @@ -156,7 +156,7 @@ function vtkCamera(publicAPI, model) { model.focalPoint[2] - (d * model.directionOfProjection[2])); }; - publicAPI.setRoll = roll => { + publicAPI.setRoll = (roll) => { }; @@ -164,7 +164,7 @@ function vtkCamera(publicAPI, model) { }; - publicAPI.roll = angle => { + publicAPI.roll = (angle) => { const eye = model.position; const at = model.focalPoint; const up = model.viewUp; @@ -182,7 +182,7 @@ function vtkCamera(publicAPI, model) { publicAPI.modified(); }; - publicAPI.azimuth = angle => { + publicAPI.azimuth = (angle) => { const newPosition = vec3.create(); const fp = model.focalPoint; @@ -201,11 +201,11 @@ function vtkCamera(publicAPI, model) { publicAPI.setPosition(newPosition[0], newPosition[1], newPosition[2]); }; - publicAPI.yaw = angle => { + publicAPI.yaw = (angle) => { }; - publicAPI.elevation = angle => { + publicAPI.elevation = (angle) => { const newPosition = vec3.create(); const fp = model.focalPoint; @@ -227,11 +227,11 @@ function vtkCamera(publicAPI, model) { publicAPI.setPosition(newPosition[0], newPosition[1], newPosition[2]); }; - publicAPI.pitch = angle => { + publicAPI.pitch = (angle) => { }; - publicAPI.zoom = factor => { + publicAPI.zoom = (factor) => { if (factor <= 0) { return; } @@ -243,7 +243,7 @@ function vtkCamera(publicAPI, model) { publicAPI.modified(); }; - publicAPI.setThickness = thickness => { + publicAPI.setThickness = (thickness) => { }; @@ -255,7 +255,7 @@ function vtkCamera(publicAPI, model) { }; - publicAPI.applyTransform = transform => { + publicAPI.applyTransform = (transform) => { }; @@ -330,15 +330,15 @@ function vtkCamera(publicAPI, model) { // // return glmatrix object // }; - publicAPI.setUserViewTransform = transform => { + publicAPI.setUserViewTransform = (transform) => { // transform is a vtkHomogeneousTransform }; - publicAPI.setUserTransform = transform => { + publicAPI.setUserTransform = (transform) => { // transform is a vtkHomogeneousTransform }; - publicAPI.render = renderer => { + publicAPI.render = (renderer) => { }; @@ -350,7 +350,7 @@ function vtkCamera(publicAPI, model) { }; - publicAPI.getFrustumPlanes = aspect => { + publicAPI.getFrustumPlanes = (aspect) => { // Return array of 24 params (4 params for each of 6 plane equations) }; @@ -370,15 +370,15 @@ function vtkCamera(publicAPI, model) { }; - publicAPI.shallowCopy = sourceCamera => { + publicAPI.shallowCopy = (sourceCamera) => { }; - publicAPI.deepCopy = sourceCamera => { + publicAPI.deepCopy = (sourceCamera) => { }; - publicAPI.setScissorRect = rect => { + publicAPI.setScissorRect = (rect) => { // rect is a vtkRect }; diff --git a/Sources/Rendering/Core/InteractorStyle/index.js b/Sources/Rendering/Core/InteractorStyle/index.js index b80019f8843..3a482920637 100644 --- a/Sources/Rendering/Core/InteractorStyle/index.js +++ b/Sources/Rendering/Core/InteractorStyle/index.js @@ -74,7 +74,7 @@ function vtkInteractorStyle(publicAPI, model) { model.interactor = i; if (i) { - events.forEach(eventName => { + events.forEach((eventName) => { model.unsubscribes.set(eventName, i[`on${eventName}`](() => { if (publicAPI[`handle${eventName}`]) { @@ -86,7 +86,7 @@ function vtkInteractorStyle(publicAPI, model) { }; // create bunch of Start/EndState methods - Object.keys(stateNames).forEach(key => { + Object.keys(stateNames).forEach((key) => { publicAPI[`start${key}`] = () => { if (model.state !== STATES.VTKIS_NONE) { return; @@ -126,7 +126,7 @@ function vtkInteractorStyle(publicAPI, model) { publicAPI.findPokedRenderer(pos.x, pos.y); if (model.currentRenderer !== 0) { const ac = model.currentRenderer.getActors(); - ac.forEach(anActor => { + ac.forEach((anActor) => { anActor.getProperty().setRepresentationToWireframe(); }); } else { @@ -141,7 +141,7 @@ function vtkInteractorStyle(publicAPI, model) { publicAPI.findPokedRenderer(pos.x, pos.y); if (model.currentRenderer !== 0) { const ac = model.currentRenderer.getActors(); - ac.forEach(anActor => { + ac.forEach((anActor) => { anActor.getProperty().setRepresentationToSurface(); }); } else { diff --git a/Sources/Rendering/Core/Mapper/CoincidentTopologyHelper.js b/Sources/Rendering/Core/Mapper/CoincidentTopologyHelper.js index ed1dc6d1d02..2fff96e049a 100644 --- a/Sources/Rendering/Core/Mapper/CoincidentTopologyHelper.js +++ b/Sources/Rendering/Core/Mapper/CoincidentTopologyHelper.js @@ -1,5 +1,5 @@ export function addCoincidentTopologyMethods(publicAPI, model, nameList) { - nameList.forEach(item => { + nameList.forEach((item) => { publicAPI[`get${item.method}`] = () => model[item.key]; publicAPI[`set${item.method}`] = (factor, unit) => { model[item.key] = { factor, unit }; diff --git a/Sources/Rendering/Core/Mapper/index.js b/Sources/Rendering/Core/Mapper/index.js index a1884f91ba6..fb6a1744ebb 100644 --- a/Sources/Rendering/Core/Mapper/index.js +++ b/Sources/Rendering/Core/Mapper/index.js @@ -23,9 +23,7 @@ CoincidentTopologyHelper.addCoincidentTopologyMethods( staticOffsetAPI, staticOffsetModel, CoincidentTopologyHelper.CATEGORIES - .map(key => { - return { key, method: `ResolveCoincidentTopology${key}OffsetParameters` }; - }) + .map(key => ({ key, method: `ResolveCoincidentTopology${key}OffsetParameters` })) ); // ---------------------------------------------------------------------------- @@ -56,7 +54,7 @@ function vtkMapper(publicAPI, model) { publicAPI.getInputData(); }; - publicAPI.setForceCompileOnly = v => { + publicAPI.setForceCompileOnly = (v) => { model.forceCompileOnly = v; // make sure we do NOT call modified() }; @@ -81,10 +79,10 @@ function vtkMapper(publicAPI, model) { publicAPI.setScalarModeToUseFieldData = () => publicAPI.setScalarMode(5); // Add Static methods to our instance - Object.keys(otherStaticMethods).forEach(methodName => { + Object.keys(otherStaticMethods).forEach((methodName) => { publicAPI[methodName] = otherStaticMethods[methodName]; }); - Object.keys(staticOffsetAPI).forEach(methodName => { + Object.keys(staticOffsetAPI).forEach((methodName) => { publicAPI[methodName] = staticOffsetAPI[methodName]; }); @@ -99,10 +97,7 @@ function vtkMapper(publicAPI, model) { publicAPI, model.topologyOffset, CoincidentTopologyHelper.CATEGORIES - .map(key => { - // GetRelativeCoincidentTopologyPolygon - return { key, method: `RelativeCoincidentTopology${key}OffsetParameters` }; - }) + .map(key => ({ key, method: `RelativeCoincidentTopology${key}OffsetParameters` })) ); /* eslint-enable arrow-body-style */ @@ -210,7 +205,7 @@ function vtkMapper(publicAPI, model) { return true; }; - publicAPI.canUseTextureMapForColoring = input => { + publicAPI.canUseTextureMapForColoring = (input) => { console.log('vtkMapper::canUseTextureMapForColoring - NOT IMPLEMENTED'); return false; }; diff --git a/Sources/Rendering/Core/Prop/index.js b/Sources/Rendering/Core/Prop/index.js index 8627ba92bec..ab7a3f179cd 100644 --- a/Sources/Rendering/Core/Prop/index.js +++ b/Sources/Rendering/Core/Prop/index.js @@ -1,7 +1,7 @@ import * as macro from '../../../macro'; function notImplemented(method) { - return () => console.log('vtkProp::${method} - NOT IMPLEMENTED'); + return () => console.log(`vtkProp::${method} - NOT IMPLEMENTED`); } // ---------------------------------------------------------------------------- @@ -21,7 +21,7 @@ function vtkProp(publicAPI, model) { publicAPI.getRedrawMTime = () => model.mtime; - publicAPI.setEstimatedRenderTime = t => { + publicAPI.setEstimatedRenderTime = (t) => { model.estimatedRenderTime = t; model.savedEstimatedRenderTime = t; }; @@ -30,11 +30,11 @@ function vtkProp(publicAPI, model) { model.estimatedRenderTime = model.savedEstimatedRenderTime; }; - publicAPI.addEstimatedRenderTime = t => { + publicAPI.addEstimatedRenderTime = (t) => { model.estimatedRenderTime += t; }; - publicAPI.setAllocatedRenderTime = t => { + publicAPI.setAllocatedRenderTime = (t) => { model.allocatedRenderTime = t; model.savedEstimatedRenderTime = model.estimatedRenderTime; model.estimatedRenderTime = 0; @@ -43,7 +43,7 @@ function vtkProp(publicAPI, model) { publicAPI.getSupportsSelection = () => false; publicAPI.getTextures = () => model.textures; - publicAPI.hasTexture = (texture) => !!model.textures.filter(item => item === texture).length; + publicAPI.hasTexture = texture => !!model.textures.filter(item => item === texture).length; publicAPI.addTexture = (texture) => { if (texture && !publicAPI.hasTexture(texture)) { model.textures = model.textures.concat(texture); diff --git a/Sources/Rendering/Core/Prop3D/index.js b/Sources/Rendering/Core/Prop3D/index.js index af630d6b2b4..ee4e7bf7cc3 100644 --- a/Sources/Rendering/Core/Prop3D/index.js +++ b/Sources/Rendering/Core/Prop3D/index.js @@ -5,7 +5,7 @@ import vtkBoundingBox from '../../../Common/DataModel/BoundingBox'; import vtkProp from '../Prop'; function notImplemented(method) { - return () => console.log('vtkProp3D::${method} - NOT IMPLEMENTED'); + return () => console.log(`vtkProp3D::${method} - NOT IMPLEMENTED`); } // ---------------------------------------------------------------------------- @@ -74,7 +74,7 @@ function vtkProp3D(publicAPI, model) { publicAPI.getUserMatrix = notImplemented('GetUserMatrix'); function updateIdentityFlag() { - [model.origin, model.position, model.orientation].forEach(array => { + [model.origin, model.position, model.orientation].forEach((array) => { if (array.filter(v => v !== 0).length) { model.isIdentity = false; return; diff --git a/Sources/Rendering/Core/Property/index.js b/Sources/Rendering/Core/Property/index.js index 31c039763b3..6e711d493a5 100644 --- a/Sources/Rendering/Core/Property/index.js +++ b/Sources/Rendering/Core/Property/index.js @@ -2,7 +2,7 @@ import * as macro from '../../../macro'; import { VTK_SHADING_MODEL, VTK_REPRESENTATION, VTK_INTERPOLATION } from './Constants'; function notImplemented(method) { - return () => console.log('vtkProperty::${method} - NOT IMPLEMENTED'); + return () => console.log(`vtkProperty::${method} - NOT IMPLEMENTED`); } // ---------------------------------------------------------------------------- diff --git a/Sources/Rendering/Core/RenderWindow/index.js b/Sources/Rendering/Core/RenderWindow/index.js index 1f2c58e56b2..18c1500f3fd 100644 --- a/Sources/Rendering/Core/RenderWindow/index.js +++ b/Sources/Rendering/Core/RenderWindow/index.js @@ -9,7 +9,7 @@ export function vtkRenderWindow(publicAPI, model) { model.classHierarchy.push('vtkRenderWindow'); // Add renderer - publicAPI.addRenderer = renderer => { + publicAPI.addRenderer = (renderer) => { if (publicAPI.hasRenderer(renderer)) { return; } @@ -27,7 +27,7 @@ export function vtkRenderWindow(publicAPI, model) { }; // Remove renderer - publicAPI.removeRenderer = renderer => { + publicAPI.removeRenderer = (renderer) => { model.renderers = model.renderers.filter(r => r !== renderer); publicAPI.modified(); }; @@ -35,7 +35,7 @@ export function vtkRenderWindow(publicAPI, model) { publicAPI.hasRenderer = ren => model.renderers.indexOf(ren) !== -1; // Add renderer - publicAPI.addView = view => { + publicAPI.addView = (view) => { if (publicAPI.hasView(view)) { return; } @@ -45,7 +45,7 @@ export function vtkRenderWindow(publicAPI, model) { }; // Remove renderer - publicAPI.removeView = view => { + publicAPI.removeView = (view) => { model.views = model.views.filter(r => r !== view); publicAPI.modified(); }; diff --git a/Sources/Rendering/Core/RenderWindowInteractor/index.js b/Sources/Rendering/Core/RenderWindowInteractor/index.js index a91cd4bf9e0..fa29e43cdb0 100644 --- a/Sources/Rendering/Core/RenderWindowInteractor/index.js +++ b/Sources/Rendering/Core/RenderWindowInteractor/index.js @@ -104,9 +104,9 @@ function vtkRenderWindowInteractor(publicAPI, model) { model.eventPositions[pointer] = { x: xv, y: yv, z: zv }; }; - publicAPI.getEventPosition = (pointer) => model.eventPositions[pointer]; + publicAPI.getEventPosition = pointer => model.eventPositions[pointer]; - publicAPI.getLastEventPosition = (pointer) => model.lastEventPositions[pointer]; + publicAPI.getLastEventPosition = pointer => model.lastEventPositions[pointer]; publicAPI.bindEvents = (canvas, document) => { model.canvas = canvas; @@ -224,7 +224,7 @@ function vtkRenderWindowInteractor(publicAPI, model) { let viewportren = null; let currentRenderer = null; - rc.forEach(aren => { + rc.forEach((aren) => { if (model.view.isInViewport(x, y, aren) && aren.getInteractive()) { currentRenderer = aren; } @@ -276,7 +276,7 @@ function vtkRenderWindowInteractor(publicAPI, model) { }; // create the generic Event methods - eventsWeHandle.forEach(eventName => { + eventsWeHandle.forEach((eventName) => { const lowerFirst = eventName.charAt(0).toLowerCase() + eventName.slice(1); publicAPI[`${lowerFirst}Event`] = () => { if (!model.enabled) { @@ -309,7 +309,7 @@ function vtkRenderWindowInteractor(publicAPI, model) { // store the initial positions if (event === 'LeftButtonPress') { - Object.keys(model.pointersDown).forEach(key => { + Object.keys(model.pointersDown).forEach((key) => { model.startingEventPositions[key] = model.eventPositions[key]; }); @@ -337,7 +337,7 @@ function vtkRenderWindowInteractor(publicAPI, model) { let count = 0; const posVals = []; const startVals = []; - Object.keys(model.pointersDown).forEach(key => { + Object.keys(model.pointersDown).forEach((key) => { posVals[count] = model.eventPositions[key]; startVals[count] = model.startingEventPositions[key]; count++; @@ -436,7 +436,7 @@ function vtkRenderWindowInteractor(publicAPI, model) { } }; - publicAPI.setScale = scale => { + publicAPI.setScale = (scale) => { model.lastScale = model.scale; if (model.scale !== scale) { model.scale = scale; @@ -444,7 +444,7 @@ function vtkRenderWindowInteractor(publicAPI, model) { } }; - publicAPI.setRotation = rot => { + publicAPI.setRotation = (rot) => { model.lastRotation = model.rotation; if (model.rotation !== rot) { model.rotation = rot; @@ -452,7 +452,7 @@ function vtkRenderWindowInteractor(publicAPI, model) { } }; - publicAPI.setTranslation = trans => { + publicAPI.setTranslation = (trans) => { model.lastTranslation = model.translation; if (model.translation !== trans) { model.translation = trans; diff --git a/Sources/Rendering/Core/Renderer/index.js b/Sources/Rendering/Core/Renderer/index.js index 570890965e3..744f4af2c6a 100644 --- a/Sources/Rendering/Core/Renderer/index.js +++ b/Sources/Rendering/Core/Renderer/index.js @@ -1,4 +1,4 @@ -import { mat4, vec4, vec3 } from 'gl-matrix'; +import { mat4, vec3 } from 'gl-matrix'; import * as macro from '../../../macro'; import vtkCamera from '../Camera'; @@ -8,70 +8,70 @@ import vtkViewport from '../Viewport'; import { INIT_BOUNDS } from '../../../Common/DataModel/BoundingBox'; function notImplemented(method) { - return () => console.log('vtkRenderer::${method} - NOT IMPLEMENTED'); + return () => console.log(`vtkRenderer::${method} - NOT IMPLEMENTED`); } // ---------------------------------------------------------------------------- // Global methods // ---------------------------------------------------------------------------- -function expandBounds(bounds, matrix) { - if (!bounds) { - vtkErrorMacro('ERROR: Invalid bounds'); - return; - } - - if (!matrix) { - vtkErrorMacro('ERROR: Invalid matrix'); - return; - } - - // Expand the bounding box by model view transform matrix. - const pt = [ - vec4.fromValues(bounds[0], bounds[2], bounds[5], 1.0), - vec4.fromValues(bounds[1], bounds[2], bounds[5], 1.0), - vec4.fromValues(bounds[1], bounds[2], bounds[4], 1.0), - vec4.fromValues(bounds[0], bounds[2], bounds[4], 1.0), - vec4.fromValues(bounds[0], bounds[3], bounds[5], 1.0), - vec4.fromValues(bounds[1], bounds[3], bounds[5], 1.0), - vec4.fromValues(bounds[1], bounds[3], bounds[4], 1.0), - vec4.fromValues(bounds[0], bounds[3], bounds[4], 1.0), - ]; - - // \note: Assuming that matrix does not have projective component. Hence not - // dividing by the homogeneous coordinate after multiplication - for (let i = 0; i < 8; ++i) { - vec4.transformMat4(pt[i], pt[i], matrix); - } - - // min = mpx = pt[0] - const min = []; - const max = []; - for (let i = 0; i < 4; ++i) { - min[i] = pt[0][i]; - max[i] = pt[0][i]; - } - - for (let i = 1; i < 8; ++i) { - for (let j = 0; j < 3; ++j) { - if (min[j] > pt[i][j]) { - min[j] = pt[i][j]; - } - if (max[j] < pt[i][j]) { - max[j] = pt[i][j]; - } - } - } - - // Copy values back to bounds. - bounds[0] = min[0]; - bounds[2] = min[1]; - bounds[4] = min[2]; - - bounds[1] = max[0]; - bounds[3] = max[1]; - bounds[5] = max[2]; -} +// function expandBounds(bounds, matrix) { +// if (!bounds) { +// vtkErrorMacro('ERROR: Invalid bounds'); +// return; +// } + +// if (!matrix) { +// vtkErrorMacro('ERROR: Invalid matrix'); +// return; +// } + +// // Expand the bounding box by model view transform matrix. +// const pt = [ +// vec4.fromValues(bounds[0], bounds[2], bounds[5], 1.0), +// vec4.fromValues(bounds[1], bounds[2], bounds[5], 1.0), +// vec4.fromValues(bounds[1], bounds[2], bounds[4], 1.0), +// vec4.fromValues(bounds[0], bounds[2], bounds[4], 1.0), +// vec4.fromValues(bounds[0], bounds[3], bounds[5], 1.0), +// vec4.fromValues(bounds[1], bounds[3], bounds[5], 1.0), +// vec4.fromValues(bounds[1], bounds[3], bounds[4], 1.0), +// vec4.fromValues(bounds[0], bounds[3], bounds[4], 1.0), +// ]; + +// // \note: Assuming that matrix does not have projective component. Hence not +// // dividing by the homogeneous coordinate after multiplication +// for (let i = 0; i < 8; ++i) { +// vec4.transformMat4(pt[i], pt[i], matrix); +// } + +// // min = mpx = pt[0] +// const min = []; +// const max = []; +// for (let i = 0; i < 4; ++i) { +// min[i] = pt[0][i]; +// max[i] = pt[0][i]; +// } + +// for (let i = 1; i < 8; ++i) { +// for (let j = 0; j < 3; ++j) { +// if (min[j] > pt[i][j]) { +// min[j] = pt[i][j]; +// } +// if (max[j] < pt[i][j]) { +// max[j] = pt[i][j]; +// } +// } +// } + +// // Copy values back to bounds. +// bounds[0] = min[0]; +// bounds[2] = min[1]; +// bounds[4] = min[2]; + +// bounds[1] = max[0]; +// bounds[3] = max[1]; +// bounds[5] = max[2]; +// } // ---------------------------------------------------------------------------- // vtkRenderer methods @@ -106,7 +106,7 @@ function vtkRenderer(publicAPI, model) { const camera = publicAPI.getActiveCameraAndResetIfCreated(); const lightMatrix = camera.getCameraLightTransformMatrix(); - model.lights.forEach(light => { + model.lights.forEach((light) => { if (light.lightTypeIsSceneLight()) { // Do nothing. Don't reset the transform matrix because applications // may have set a custom matrix. Only reset the transform matrix in @@ -138,7 +138,7 @@ function vtkRenderer(publicAPI, model) { publicAPI.getVTKWindow = () => model.renderWindow; - publicAPI.setLayer = layer => { + publicAPI.setLayer = (layer) => { vtkDebugMacro(publicAPI.getClassName(), publicAPI, 'setting Layer to ', layer); if (model.layer !== layer) { model.layer = layer; @@ -147,7 +147,7 @@ function vtkRenderer(publicAPI, model) { publicAPI.setPreserveColorBuffer(!!layer); }; - publicAPI.setActiveCamera = camera => { + publicAPI.setActiveCamera = (camera) => { if (model.activeCamera === camera) { return false; } @@ -185,24 +185,24 @@ function vtkRenderer(publicAPI, model) { publicAPI.addActor = publicAPI.addViewProp; publicAPI.addVolume = publicAPI.addViewProp; - publicAPI.removeActor = actor => { + publicAPI.removeActor = (actor) => { model.actors = model.actors.filter(a => a !== actor); publicAPI.removeViewProp(actor); }; - publicAPI.removeVolume = volume => { + publicAPI.removeVolume = (volume) => { model.volumes = model.volumes.filter(v => v !== volume); publicAPI.removeViewProp(volume); }; - publicAPI.addLight = light => { + publicAPI.addLight = (light) => { model.lights = [].concat(model.lights, light); publicAPI.modified(); }; publicAPI.getActors = () => { model.actors = []; - model.props.forEach(prop => { + model.props.forEach((prop) => { model.actors = model.actors.concat(prop.getActors()); }); return model.actors; @@ -210,13 +210,13 @@ function vtkRenderer(publicAPI, model) { publicAPI.getVolumes = () => { model.volumes = []; - model.props.forEach(prop => { + model.props.forEach((prop) => { model.volumes = model.volumes.concat(prop.getVolumes()); }); return model.volumes; }; - publicAPI.removeLight = light => { + publicAPI.removeLight = (light) => { model.lights = model.lights.filter(l => l !== light); publicAPI.modified(); }; @@ -316,7 +316,7 @@ function vtkRenderer(publicAPI, model) { // loop through all props model.props .filter(prop => prop.getVisibility() && prop.getUseBounds()) - .forEach(prop => { + .forEach((prop) => { const bounds = prop.getBounds(); if (bounds && vtkMath.areBoundsInitialized(bounds)) { nothingVisible = false; @@ -520,7 +520,7 @@ function vtkRenderer(publicAPI, model) { return false; }; - publicAPI.setRenderWindow = renderWindow => { + publicAPI.setRenderWindow = (renderWindow) => { if (renderWindow !== model.renderWindow) { model.vtkWindow = renderWindow; model.renderWindow = renderWindow; diff --git a/Sources/Rendering/Core/Viewport/index.js b/Sources/Rendering/Core/Viewport/index.js index 3f7408de051..dfe684cc17e 100644 --- a/Sources/Rendering/Core/Viewport/index.js +++ b/Sources/Rendering/Core/Viewport/index.js @@ -1,7 +1,7 @@ import * as macro from '../../../macro'; function notImplemented(method) { - return () => console.log('vtkViewport::${method} - NOT IMPLEMENTED'); + return () => console.log(`vtkViewport::${method} - NOT IMPLEMENTED`); } // ---------------------------------------------------------------------------- @@ -14,7 +14,7 @@ function vtkViewport(publicAPI, model) { // Public API methods publicAPI.getViewProps = () => model.props; - publicAPI.hasViewProp = (prop) => !!model.props.filter(item => item === prop).length; + publicAPI.hasViewProp = prop => !!model.props.filter(item => item === prop).length; publicAPI.addViewProp = (prop) => { if (prop && !publicAPI.hasViewProp(prop)) { model.props = model.props.concat(prop); @@ -40,7 +40,7 @@ function vtkViewport(publicAPI, model) { publicAPI.getActors2D = () => { model.actors2D = []; - model.props.forEach(prop => { + model.props.forEach((prop) => { model.actors2D = model.actors2D.concat(prop.getActors2D()); }); return model.actors2D; diff --git a/Sources/Rendering/OpenGL/Actor/index.js b/Sources/Rendering/OpenGL/Actor/index.js index a446adbce0f..57cebc3780d 100644 --- a/Sources/Rendering/OpenGL/Actor/index.js +++ b/Sources/Rendering/OpenGL/Actor/index.js @@ -26,18 +26,18 @@ function vtkOpenGLActor(publicAPI, model) { }; // we draw textures, then mapper, then post pass textures - publicAPI.traverse = operation => { + publicAPI.traverse = (operation) => { publicAPI.apply(operation, true); model.activeTextures = []; - model.children.forEach(child => { + model.children.forEach((child) => { child.apply(operation, true); if (child.isA('vtkOpenGLTexture') && operation === 'Render') { model.activeTextures.push(child); } }); - model.children.forEach(child => { + model.children.forEach((child) => { child.apply(operation, false); }); @@ -51,7 +51,7 @@ function vtkOpenGLActor(publicAPI, model) { publicAPI.preRender(); } else { // deactivate textures - model.children.forEach(child => { + model.children.forEach((child) => { if (child.isA('vtkOpenGLTexture')) { child.deactivate(); } diff --git a/Sources/Rendering/OpenGL/Actor2D/index.js b/Sources/Rendering/OpenGL/Actor2D/index.js index 34d22710b7b..6f8ee5923e5 100644 --- a/Sources/Rendering/OpenGL/Actor2D/index.js +++ b/Sources/Rendering/OpenGL/Actor2D/index.js @@ -24,18 +24,18 @@ function vtkOpenGLActor2D(publicAPI, model) { }; // we draw textures, then mapper, then post pass textures - publicAPI.traverse = operation => { + publicAPI.traverse = (operation) => { publicAPI.apply(operation, true); model.activeTextures = []; - model.children.forEach(child => { + model.children.forEach((child) => { child.apply(operation, true); if (child.isA('vtkOpenGLTexture') && operation === 'Render') { model.activeTextures.push(child); } }); - model.children.forEach(child => { + model.children.forEach((child) => { child.apply(operation, false); }); @@ -49,7 +49,7 @@ function vtkOpenGLActor2D(publicAPI, model) { publicAPI.preRender(); } else { // deactivate textures - model.children.forEach(child => { + model.children.forEach((child) => { if (child.isA('vtkOpenGLTexture')) { child.deactivate(); } diff --git a/Sources/Rendering/OpenGL/BufferObject/index.js b/Sources/Rendering/OpenGL/BufferObject/index.js index df747bbc1a7..b8a32c5bd5f 100644 --- a/Sources/Rendering/OpenGL/BufferObject/index.js +++ b/Sources/Rendering/OpenGL/BufferObject/index.js @@ -45,14 +45,14 @@ function vtkOpenGLBufferObject(publicAPI, model) { // Public API methods publicAPI.getType = () => internalType; - publicAPI.setType = value => { + publicAPI.setType = (value) => { internalType = value; }; publicAPI.getHandle = () => internalHandle; publicAPI.isReady = () => dirty === false; - publicAPI.generateBuffer = type => { + publicAPI.generateBuffer = (type) => { const objectTypeGL = convertType(type); if (internalHandle === null) { internalHandle = model.context.createBuffer(); diff --git a/Sources/Rendering/OpenGL/CellArrayBufferObject/index.js b/Sources/Rendering/OpenGL/CellArrayBufferObject/index.js index 52703d17cf2..8865090e5f2 100644 --- a/Sources/Rendering/OpenGL/CellArrayBufferObject/index.js +++ b/Sources/Rendering/OpenGL/CellArrayBufferObject/index.js @@ -187,15 +187,15 @@ function vtkOpenGLCellArrayBufferObject(publicAPI, model) { return cellCount; }; - publicAPI.setCoordShiftAndScaleMethod = shiftScaleMethod => { + publicAPI.setCoordShiftAndScaleMethod = (shiftScaleMethod) => { console.log('coordinate shift and scale not yet implemented'); }; - publicAPI.setCoordShift = shiftArray => { + publicAPI.setCoordShift = (shiftArray) => { console.log('coordinate shift and scale not yet implemented'); }; - publicAPI.setCoordScale = scaleArray => { + publicAPI.setCoordScale = (scaleArray) => { console.log('coordinate shift and scale not yet implemented'); }; } diff --git a/Sources/Rendering/OpenGL/PolyDataMapper/index.js b/Sources/Rendering/OpenGL/PolyDataMapper/index.js index 40ac2686c05..05c70b7e356 100644 --- a/Sources/Rendering/OpenGL/PolyDataMapper/index.js +++ b/Sources/Rendering/OpenGL/PolyDataMapper/index.js @@ -526,7 +526,7 @@ export function vtkOpenGLPolyDataMapper(publicAPI, model) { lightComplexity = 0; let numberOfLights = 0; - ren.getLights().forEach(light => { + ren.getLights().forEach((light) => { const status = light.getSwitch(); if (status > 0) { numberOfLights++; @@ -649,7 +649,7 @@ export function vtkOpenGLPolyDataMapper(publicAPI, model) { } const tus = model.openGLActor.getActiveTextures(); - tus.forEach(tex => { + tus.forEach((tex) => { const texUnit = tex.getTextureUnit(); const tname = `texture${texUnit + 1}`; if (cellBO.getProgram().isUniformUsed(tname)) { @@ -677,7 +677,7 @@ export function vtkOpenGLPolyDataMapper(publicAPI, model) { // const lightDirection = []; // const lightHalfAngle = []; const lights = ren.getLights(); - Object.keys(lights).map(key => lights[key]).forEach(light => { + Object.keys(lights).map(key => lights[key]).forEach((light) => { const status = light.getSwitch(); if (status > 0.0) { const dColor = light.getDiffuseColor(); diff --git a/Sources/Rendering/OpenGL/RenderWindow/index.js b/Sources/Rendering/OpenGL/RenderWindow/index.js index e072a2d0193..c394404e485 100644 --- a/Sources/Rendering/OpenGL/RenderWindow/index.js +++ b/Sources/Rendering/OpenGL/RenderWindow/index.js @@ -65,7 +65,7 @@ export function vtkOpenGLRenderWindow(publicAPI, model) { publicAPI.render = (prepass) => { if (prepass) { publicAPI.initialize(); - model.children.forEach(child => { + model.children.forEach((child) => { child.setContext(model.context); }); } else { @@ -73,7 +73,7 @@ export function vtkOpenGLRenderWindow(publicAPI, model) { } }; - publicAPI.setContainer = el => { + publicAPI.setContainer = (el) => { if (model.el && model.el !== el) { // Remove canvas from previous container if (model.canvas.parentNode === model.el) { @@ -104,13 +104,13 @@ export function vtkOpenGLRenderWindow(publicAPI, model) { return false; }; - publicAPI.getViewportSize = viewport => { + publicAPI.getViewportSize = (viewport) => { const vCoords = viewport.getViewport(); const size = model.size; return [(vCoords[2] - vCoords[0]) * size[0], (vCoords[3] - vCoords[1]) * size[1]]; }; - publicAPI.getViewportCenter = viewport => { + publicAPI.getViewportCenter = (viewport) => { const size = publicAPI.getViewportSize(viewport); return [size[0] * 0.5, size[1] * 0.5]; }; @@ -126,7 +126,7 @@ export function vtkOpenGLRenderWindow(publicAPI, model) { publicAPI.get3DContext = (options = { preserveDrawingBuffer: true, premultipliedAlpha: false }) => model.canvas.getContext('webgl', options) || model.canvas.getContext('experimental-webgl', options); - publicAPI.activateTexture = texture => { + publicAPI.activateTexture = (texture) => { // Only add if it isn't already there const result = model.textureResourceIds.get(texture); if (result !== undefined) { @@ -144,7 +144,7 @@ export function vtkOpenGLRenderWindow(publicAPI, model) { model.context.activeTexture(model.context.TEXTURE0 + activeUnit); }; - publicAPI.deactivateTexture = texture => { + publicAPI.deactivateTexture = (texture) => { // Only deactivate if it isn't already there const result = model.textureResourceIds.get(texture); if (result !== undefined) { @@ -153,7 +153,7 @@ export function vtkOpenGLRenderWindow(publicAPI, model) { } }; - publicAPI.getTextureUnitForTexture = texture => { + publicAPI.getTextureUnitForTexture = (texture) => { const result = model.textureResourceIds.get(texture); if (result !== undefined) { return result; diff --git a/Sources/Rendering/OpenGL/Renderer/index.js b/Sources/Rendering/OpenGL/Renderer/index.js index 77a550513f8..d2ee06680ae 100644 --- a/Sources/Rendering/OpenGL/Renderer/index.js +++ b/Sources/Rendering/OpenGL/Renderer/index.js @@ -33,7 +33,7 @@ export function vtkOpenGLRenderer(publicAPI, model) { publicAPI.updateLights = () => { let count = 0; - model.renderable.getLights().forEach(light => { + model.renderable.getLights().forEach((light) => { if (light.getSwitch() > 0.0) { count++; } @@ -64,6 +64,7 @@ export function vtkOpenGLRenderer(publicAPI, model) { }; publicAPI.clear = () => { + /* eslint-disable no-bitwise */ let clearMask = 0; const gl = model.context; @@ -83,6 +84,7 @@ export function vtkOpenGLRenderer(publicAPI, model) { gl.clear(clearMask); gl.enable(gl.DEPTH_TEST); + /* eslint-enable no-bitwise */ }; } diff --git a/Sources/Rendering/OpenGL/ShaderCache/index.js b/Sources/Rendering/OpenGL/ShaderCache/index.js index 074f6c02ca1..eecea01801a 100644 --- a/Sources/Rendering/OpenGL/ShaderCache/index.js +++ b/Sources/Rendering/OpenGL/ShaderCache/index.js @@ -119,9 +119,9 @@ function vtkShaderCache(publicAPI, model) { publicAPI.releaseCurrentShader(); - Object.keys(model.shaderPrograms).map(key => model.shaderPrograms[key]).forEach(sp => { - sp.releaseGraphicsResources(win); - }); + Object.keys(model.shaderPrograms) + .map(key => model.shaderPrograms[key]) + .forEach(sp => sp.releaseGraphicsResources(win)); }; publicAPI.releaseGraphicsResources = () => { diff --git a/Sources/Rendering/OpenGL/Texture/index.js b/Sources/Rendering/OpenGL/Texture/index.js index fadfede6b55..161bc6c0650 100644 --- a/Sources/Rendering/OpenGL/Texture/index.js +++ b/Sources/Rendering/OpenGL/Texture/index.js @@ -295,7 +295,7 @@ function vtkOpenGLTexture(publicAPI, model) { }; //---------------------------------------------------------------------------- - publicAPI.getDefaultDataType = vtkScalarType => { + publicAPI.getDefaultDataType = (vtkScalarType) => { // DON'T DEAL with VTK_CHAR as this is platform dependent. switch (vtkScalarType) { // case VTK_DATATYPES.SIGNED_CHAR: @@ -321,7 +321,7 @@ function vtkOpenGLTexture(publicAPI, model) { }; //---------------------------------------------------------------------------- - publicAPI.getOpenGLDataType = vtkScalarType => { + publicAPI.getOpenGLDataType = (vtkScalarType) => { if (!model.openGLDataType) { model.openGLDataType = publicAPI.getDefaultDataType(vtkScalarType); } diff --git a/Sources/Rendering/OpenGL/TextureUnitManager/index.js b/Sources/Rendering/OpenGL/TextureUnitManager/index.js index 81f8777fed9..90b42f4cdd7 100644 --- a/Sources/Rendering/OpenGL/TextureUnitManager/index.js +++ b/Sources/Rendering/OpenGL/TextureUnitManager/index.js @@ -21,7 +21,7 @@ function vtkOpenGLTextureUnitManager(publicAPI, model) { }; // ---------------------------------------------------------------------------- - publicAPI.setContext = ctx => { + publicAPI.setContext = (ctx) => { if (model.context !== ctx) { if (model.context !== 0) { publicAPI.deleteTable(); @@ -51,7 +51,7 @@ function vtkOpenGLTextureUnitManager(publicAPI, model) { return -1; }; - publicAPI.allocateUnit = unit => { + publicAPI.allocateUnit = (unit) => { if (publicAPI.isAllocated(unit)) { return -1; } @@ -71,7 +71,7 @@ function vtkOpenGLTextureUnitManager(publicAPI, model) { // Release a texture unit. // \pre valid_id: textureUnitId>=0 && textureUnitIdGetNumberOfTextureUnits() // \pre allocated_id: this->IsAllocated(textureUnitId) - publicAPI.free = val => { + publicAPI.free = (val) => { const newList = model.textureUnits.filter(item => item === val); if (model.textureUnits.length !== newList.length) { model.textureUnits = newList; diff --git a/Sources/Rendering/OpenGL/VertexArrayObject/index.js b/Sources/Rendering/OpenGL/VertexArrayObject/index.js index bef8728fd7f..f23011827f0 100644 --- a/Sources/Rendering/OpenGL/VertexArrayObject/index.js +++ b/Sources/Rendering/OpenGL/VertexArrayObject/index.js @@ -41,9 +41,9 @@ function vtkOpenGLVertexArrayObject(publicAPI, model) { model.extension.bindVertexArrayOES(model.handleVAO); } else if (publicAPI.isReady()) { const gl = model.context; - Object.keys(model.buffers).map(key => model.buffers[key]).forEach(buff => { + Object.keys(model.buffers).map(key => model.buffers[key]).forEach((buff) => { model.context.bindBuffer(gl.ARRAY_BUFFER, buff.buffer); - Object.keys(buff.attributes).map(key => buff.attributes[key]).forEach(attrIt => { + Object.keys(buff.attributes).map(key => buff.attributes[key]).forEach((attrIt) => { const matrixCount = attrIt.isMatrix ? attrIt.size : 1; for (let i = 0; i < matrixCount; ++i) { gl.enableVertexAttribArray(attrIt.index + i); @@ -66,8 +66,8 @@ function vtkOpenGLVertexArrayObject(publicAPI, model) { model.extension.bindVertexArrayOES(null); } else if (publicAPI.isReady()) { const gl = model.context; - Object.keys(model.buffers).map(key => model.buffers[key]).forEach(buff => { - Object.keys(buff.attributes).map(key => buff.attributes[key]).forEach(attrIt => { + Object.keys(model.buffers).map(key => model.buffers[key]).forEach((buff) => { + Object.keys(buff.attributes).map(key => buff.attributes[key]).forEach((attrIt) => { const matrixCount = attrIt.isMatrix ? attrIt.size : 1; for (let i = 0; i < matrixCount; ++i) { gl.enableVertexAttribArray(attrIt.index + i); @@ -216,7 +216,7 @@ function vtkOpenGLVertexArrayObject(publicAPI, model) { gl.disableVertexAttribArray(location); // If we don't have real VAOs find the entry and remove it too. if (!model.supported) { - Object.keys(model.buffers).map(key => model.buffers[key]).forEach(buff => { + Object.keys(model.buffers).map(key => model.buffers[key]).forEach((buff) => { delete buff.attributes[location]; }); } diff --git a/Sources/Rendering/SceneGraph/ViewNode/index.js b/Sources/Rendering/SceneGraph/ViewNode/index.js index d1fefeba450..559cf74f4e6 100644 --- a/Sources/Rendering/SceneGraph/ViewNode/index.js +++ b/Sources/Rendering/SceneGraph/ViewNode/index.js @@ -23,7 +23,7 @@ function vtkViewNode(publicAPI, model) { return publicAPI; } - return model.children.find(child => { + return model.children.find((child) => { const vn = child.getViewNodeFor(dataObject); return !!vn; }); @@ -42,7 +42,7 @@ function vtkViewNode(publicAPI, model) { publicAPI.traverse = (operation) => { publicAPI.apply(operation, true); - model.children.forEach(child => { + model.children.forEach((child) => { child.traverse(operation); }); @@ -88,7 +88,7 @@ function vtkViewNode(publicAPI, model) { const newNodes = dataObjs .filter(node => (node && childDOs.indexOf(node) === -1)) - .map(node => { + .map((node) => { const newNode = publicAPI.createViewNode(node); if (newNode) { newNode.setParent(publicAPI); diff --git a/Sources/macro.js b/Sources/macro.js index 5763b72e7f0..6789c7dcc70 100644 --- a/Sources/macro.js +++ b/Sources/macro.js @@ -43,7 +43,7 @@ export function obj(publicAPI, model = {}) { callbacks.forEach(callback => callback && callback(publicAPI)); }; - publicAPI.onModified = callback => { + publicAPI.onModified = (callback) => { if (model.deleted) { console.log('instance deleted - can not call any method'); return null; @@ -61,7 +61,7 @@ export function obj(publicAPI, model = {}) { publicAPI.getClassName = () => model.classHierarchy.slice(-1)[0]; publicAPI.set = (map = {}) => { - Object.keys(map).forEach(name => { + Object.keys(map).forEach((name) => { if (Array.isArray(map[name])) { publicAPI[`set${capitalize(name)}`](...map[name]); } else if (publicAPI[`set${capitalize(name)}`]) { @@ -81,7 +81,7 @@ export function obj(publicAPI, model = {}) { return model; } const subset = {}; - list.forEach(name => { + list.forEach((name) => { subset[name] = model[name]; }); return subset; @@ -101,7 +101,7 @@ export function obj(publicAPI, model = {}) { // ---------------------------------------------------------------------------- export function get(publicAPI, model, fieldNames) { - fieldNames.forEach(field => { + fieldNames.forEach((field) => { if (typeof field === 'object') { publicAPI[`get${capitalize(field.name)}`] = () => model[field]; } else { @@ -116,7 +116,7 @@ export function get(publicAPI, model, fieldNames) { const objectSetterMap = { enum(publicAPI, model, field) { - return value => { + return (value) => { if (typeof value === 'string') { if (model.enum[value] !== undefined) { if (model[field.name] !== model.enum[value]) { @@ -173,7 +173,7 @@ function findSetter(field) { } export function set(publicAPI, model, fields) { - fields.forEach(field => { + fields.forEach((field) => { publicAPI[`set${capitalize(field)}`] = findSetter(field)(publicAPI, model); }); } @@ -192,7 +192,7 @@ export function setGet(publicAPI, model, fieldNames) { // ---------------------------------------------------------------------------- export function getArray(publicAPI, model, fieldNames) { - fieldNames.forEach(field => { + fieldNames.forEach((field) => { publicAPI[`get${capitalize(field)}`] = () => [].concat(model[field]); }); } @@ -202,7 +202,7 @@ export function getArray(publicAPI, model, fieldNames) { // ---------------------------------------------------------------------------- export function setArray(publicAPI, model, fieldNames, size) { - fieldNames.forEach(field => { + fieldNames.forEach((field) => { publicAPI[`set${capitalize(field)}`] = (...array) => { if (model.deleted) { console.log('instance deleted - can not call any method'); @@ -320,7 +320,7 @@ export function algo(publicAPI, model, numberOfInputs, numberOfOutputs) { publicAPI.getNumberOfInputPorts = () => numberOfInputs; publicAPI.getNumberOfOutputPorts = () => numberOfOutputs; - publicAPI.getInputArrayToProcess = inputPort => { + publicAPI.getInputArrayToProcess = (inputPort) => { const arrayDesc = model.inputArrayToProcess[inputPort]; const ds = model.inputData[inputPort]; if (arrayDesc && ds) { @@ -364,7 +364,7 @@ export function event(publicAPI, model, eventName) { callbacks.forEach(callback => callback && callback.apply(publicAPI, args)); }; - publicAPI[`on${capitalize(eventName)}`] = callback => { + publicAPI[`on${capitalize(eventName)}`] = (callback) => { if (model.deleted) { console.log('instance deleted - can not call any method'); return null; diff --git a/karma.conf.js b/karma.conf.js index 2dc1c899f08..42cf11bc2b8 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,6 +1,5 @@ /* eslint-disable global-require */ /* eslint-disable react/require-extension */ -// => | awk -F': ' '{print $2}' | sed \"s/^'\\(.*\\)'$/\\1/\" | tap-spec", var loaders = require('./Utilities/config/webpack.loaders.js'); if (!process.env.NODE_ENV) process.env.NODE_ENV = 'test'; diff --git a/package.json b/package.json index b66b9e404a2..92b0bf3efa6 100644 --- a/package.json +++ b/package.json @@ -12,16 +12,15 @@ "main": "./Sources/index.js", "dependencies": { "commander": "2.9.0", - "shelljs": "0.5.3", + "shelljs": "0.7.4", "gh-pages": "0.10.0", - "string-replace-loader": "1.0.0", "pako": "1.0.1", "blueimp-md5": "2.3.0", "gl-matrix": "2.3.1" }, "devDependencies": { - "kw-web-suite": "2.1.1", - "kw-doc": "1.0.13", + "kw-web-suite": "2.2.1", + "kw-doc": "1.0.15", "babel-plugin-istanbul": "2.0.0", "babel-polyfill": "6.13.0",