From 1900250df78546946818544cd9c80fd93961908c Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Sat, 7 Mar 2020 21:11:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=80=E6=9C=89eslint?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc | 11 ++++-- ShadowEditor.Web/src/command/History.js | 34 +++++++++++-------- .../src/command/MoveObjectCommand.js | 6 ++-- .../src/command/MultiCmdsCommand.js | 2 +- .../src/command/RemoveObjectCommand.js | 6 ++-- .../src/command/RemoveScriptCommand.js | 4 +-- .../src/command/SetColorCommand.js | 6 ++-- .../src/command/SetGeometryCommand.js | 4 +-- .../src/command/SetGeometryValueCommand.js | 6 ++-- .../src/command/SetMaterialColorCommand.js | 6 ++-- .../src/command/SetMaterialCommand.js | 4 +-- .../src/command/SetMaterialMapCommand.js | 6 ++-- .../src/command/SetMaterialValueCommand.js | 6 ++-- .../src/command/SetPositionCommand.js | 6 ++-- .../src/command/SetRotationCommand.js | 6 ++-- .../src/command/SetScaleCommand.js | 6 ++-- .../src/command/SetSceneCommand.js | 2 +- .../src/command/SetScriptValueCommand.js | 12 +++---- .../src/command/SetUuidCommand.js | 4 +-- .../src/command/SetValueCommand.js | 6 ++-- .../controls/OrthographicCameraControls.js | 4 +-- ShadowEditor.Web/src/event/PhysicsEvent.js | 2 +- .../src/event/visual/DraggableEvent.js | 5 ++- ShadowEditor.Web/src/gis/render/Renderers.js | 2 +- .../src/gis/render/SunRenderer.js | 2 +- .../src/gis/render/TiledLayerRenderer.js | 2 +- ShadowEditor.Web/src/gis/tile/Tile.js | 2 +- .../src/object/component/Water.js | 14 ++++---- .../component/physics/ThrowBallEvent.js | 4 +-- .../extension/ANGLE_instanced_arrays.js | 3 +- .../src/render/extension/EXT_blend_minmax.js | 3 +- .../extension/EXT_color_buffer_half_float.js | 3 +- .../extension/EXT_disjoint_timer_query.js | 3 +- .../src/render/extension/EXT_frag_depth.js | 3 +- .../src/render/extension/EXT_sRGB.js | 3 +- .../extension/EXT_shader_texture_lod.js | 3 +- .../EXT_texture_filter_anisotropic.js | 3 +- .../extension/OES_element_index_uint.js | 3 +- .../extension/OES_standard_derivatives.js | 3 +- .../src/render/extension/OES_texture_float.js | 3 +- .../extension/OES_texture_float_linear.js | 3 +- .../extension/OES_texture_half_float.js | 3 +- .../OES_texture_half_float_linear.js | 3 +- .../extension/OES_vertex_array_object.js | 3 +- .../extension/WEBGL_color_buffer_float.js | 3 +- .../WEBGL_compressed_texture_s3tc.js | 3 +- .../WEBGL_compressed_texture_s3tc_srgb.js | 3 +- .../extension/WEBGL_debug_renderer_info.js | 3 +- .../render/extension/WEBGL_debug_shaders.js | 3 +- .../render/extension/WEBGL_depth_texture.js | 3 +- .../render/extension/WEBGL_draw_buffers.js | 3 +- .../render/extension/WEBGL_lose_context.js | 3 +- ShadowEditor.Web/src/visual/BaseComponent.js | 4 +-- .../src/visual/component/ChordGraph.js | 4 +-- .../src/visual/component/Histogram.js | 2 +- .../src/visual/component/Histogram2.js | 4 +-- .../src/visual/component/PackDiagram.js | 2 +- .../src/visual/component/PartitionDiagram.js | 4 +-- .../src/visual/component/ScatterPlot.js | 4 +-- ShadowEditor.Web/src/visual/demo/BarChart.js | 2 +- ShadowEditor.Web/src/visual/demo/Panel.js | 2 +- ShadowEditor.Web/src/visual/demo/Sidebar.js | 14 ++++---- ShadowEditor.Web/src/visual/event/Drag.js | 1 + 63 files changed, 164 insertions(+), 128 deletions(-) diff --git a/.eslintrc b/.eslintrc index c5141f70..a4621278 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,8 +5,10 @@ "plugin:react/recommended" ], "parser": "babel-eslint", - "ecmaFeatures": { - "jsx": true + "parserOptions": { + "ecmaFeatures": { + "jsx": true + } }, "plugins": [ "react" @@ -19,6 +21,11 @@ "es6": true, "worker": true }, + "settings": { + "react": { + "version": "16.8.6" + } + }, "rules": { "eqeqeq": 2, "comma-dangle": 1, diff --git a/ShadowEditor.Web/src/command/History.js b/ShadowEditor.Web/src/command/History.js index c56c0746..efa711b2 100644 --- a/ShadowEditor.Web/src/command/History.js +++ b/ShadowEditor.Web/src/command/History.js @@ -113,16 +113,18 @@ Object.assign(History.prototype, { history.undos = []; history.redos = []; + var i; + // Append Undos to History - for (var i = 0; i < this.undos.length; i++) { - if (this.undos[i].hasOwnProperty("json")) { + for (i = 0; i < this.undos.length; i++) { + if (Object.prototype.hasOwnProperty.call(this.undos[i], "json")) { history.undos.push(this.undos[i].json); } } // Append Redos to History - for (var i = 0; i < this.redos.length; i++) { - if (this.redos[i].hasOwnProperty("json")) { + for (i = 0; i < this.redos.length; i++) { + if (Object.prototype.hasOwnProperty.call(this.redos[i], "json")) { history.redos.push(this.redos[i].json); } } @@ -133,9 +135,11 @@ Object.assign(History.prototype, { fromJSON: function (json) { if (json === undefined) return; - for (var i = 0; i < json.undos.length; i++) { - var cmdJSON = json.undos[i]; - var cmd = new window[cmdJSON.type](); // creates a new object of type "json.type" + var i = 0, cmdJSON, cmd; + + for (i = 0; i < json.undos.length; i++) { + cmdJSON = json.undos[i]; + cmd = new window[cmdJSON.type](); // creates a new object of type "json.type" cmd.json = cmdJSON; cmd.id = cmdJSON.id; cmd.name = cmdJSON.name; @@ -143,9 +147,9 @@ Object.assign(History.prototype, { this.idCounter = cmdJSON.id > this.idCounter ? cmdJSON.id : this.idCounter; // set last used idCounter } - for (var i = 0; i < json.redos.length; i++) { - var cmdJSON = json.redos[i]; - var cmd = new window[cmdJSON.type](); // creates a new object of type "json.type" + for (i = 0; i < json.redos.length; i++) { + cmdJSON = json.redos[i]; + cmd = new window[cmdJSON.type](); // creates a new object of type "json.type" cmd.json = cmdJSON; cmd.id = cmdJSON.id; cmd.name = cmdJSON.name; @@ -174,13 +178,15 @@ Object.assign(History.prototype, { cmd = this.redo(); } } else { - while (true) { + while (true) { // eslint-disable-line cmd = this.undos[this.undos.length - 1]; // next cmd to pop - if (cmd === undefined || id === cmd.id) break; + if (cmd === undefined || id === cmd.id) { + break; + } cmd = this.undo(); } } - + app.call('historyChanged', this, cmd); }, @@ -197,7 +203,7 @@ Object.assign(History.prototype, { var cmd = this.redo(); while (cmd !== undefined) { - if (!cmd.hasOwnProperty("json")) { + if (!Object.prototype.hasOwnProperty.call(cmd, "json")) { cmd.json = cmd.toJSON(); } cmd = this.redo(); diff --git a/ShadowEditor.Web/src/command/MoveObjectCommand.js b/ShadowEditor.Web/src/command/MoveObjectCommand.js index 2dd75316..2c887051 100644 --- a/ShadowEditor.Web/src/command/MoveObjectCommand.js +++ b/ShadowEditor.Web/src/command/MoveObjectCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 移动物体命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param newParent THREE.Object3D - * @param newBefore THREE.Object3D + * @param {THREE.Object3D} object 当前物体 + * @param {THREE.Object3D} newParent 新的父要素 + * @param {THREE.Object3D} newBefore 旧的父要素 * @constructor */ function MoveObjectCommand(object, newParent, newBefore) { diff --git a/ShadowEditor.Web/src/command/MultiCmdsCommand.js b/ShadowEditor.Web/src/command/MultiCmdsCommand.js index 9067df56..26663b87 100644 --- a/ShadowEditor.Web/src/command/MultiCmdsCommand.js +++ b/ShadowEditor.Web/src/command/MultiCmdsCommand.js @@ -4,7 +4,7 @@ import Command from './Command'; * 同时执行多种命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param cmdArray array containing command objects + * @param {Array} cmdArray array containing command objects * @constructor */ function MultiCmdsCommand(cmdArray) { diff --git a/ShadowEditor.Web/src/command/RemoveObjectCommand.js b/ShadowEditor.Web/src/command/RemoveObjectCommand.js index d9825113..3e88d873 100644 --- a/ShadowEditor.Web/src/command/RemoveObjectCommand.js +++ b/ShadowEditor.Web/src/command/RemoveObjectCommand.js @@ -4,7 +4,7 @@ import Command from './Command'; * 移除物体命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D + * @param {THREE.Object3D} object 物体 * @constructor */ function RemoveObjectCommand(object) { @@ -28,7 +28,7 @@ Object.assign(RemoveObjectCommand.prototype, { constructor: RemoveObjectCommand, execute: function () { - var scope = this.editor; + // var scope = this.editor; this.parent.remove(this.object); @@ -40,7 +40,7 @@ Object.assign(RemoveObjectCommand.prototype, { }, undo: function () { - var scope = this.editor; + // var scope = this.editor; this.parent.children.splice(this.index, 0, this.object); this.object.parent = this.parent; diff --git a/ShadowEditor.Web/src/command/RemoveScriptCommand.js b/ShadowEditor.Web/src/command/RemoveScriptCommand.js index 73cb8d54..b4b2aeb4 100644 --- a/ShadowEditor.Web/src/command/RemoveScriptCommand.js +++ b/ShadowEditor.Web/src/command/RemoveScriptCommand.js @@ -4,8 +4,8 @@ import Command from './Command'; * 移除脚本命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param script javascript object + * @param {THREE.Object3D} object 物体 + * @param {String} script 脚本 * @constructor */ function RemoveScriptCommand(object, script) { diff --git a/ShadowEditor.Web/src/command/SetColorCommand.js b/ShadowEditor.Web/src/command/SetColorCommand.js index a5292f91..4dba6f59 100644 --- a/ShadowEditor.Web/src/command/SetColorCommand.js +++ b/ShadowEditor.Web/src/command/SetColorCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 设置颜色命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param attributeName string - * @param newValue integer representing a hex color value + * @param {THREE.Object3D} object 物体 + * @param {String} attributeName 属性名称 + * @param {Object} newValue HEX颜色值 * @constructor */ function SetColorCommand(object, attributeName, newValue) { diff --git a/ShadowEditor.Web/src/command/SetGeometryCommand.js b/ShadowEditor.Web/src/command/SetGeometryCommand.js index 066befeb..1a901303 100644 --- a/ShadowEditor.Web/src/command/SetGeometryCommand.js +++ b/ShadowEditor.Web/src/command/SetGeometryCommand.js @@ -4,8 +4,8 @@ import Command from './Command'; * 设置几何体命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param newGeometry THREE.Geometry + * @param {THREE.Object3D} object 物体 + * @param {THREE.Geometry} newGeometry 几何体 * @constructor */ function SetGeometryCommand(object, newGeometry) { diff --git a/ShadowEditor.Web/src/command/SetGeometryValueCommand.js b/ShadowEditor.Web/src/command/SetGeometryValueCommand.js index a773922b..79b62b7b 100644 --- a/ShadowEditor.Web/src/command/SetGeometryValueCommand.js +++ b/ShadowEditor.Web/src/command/SetGeometryValueCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 设置几何体值命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param attributeName string - * @param newValue number, string, boolean or object + * @param {THREE.Object3D} object 物体 + * @param {String} attributeName 属性名称 + * @param {Object} newValue number, string, boolean or object * @constructor */ function SetGeometryValueCommand(object, attributeName, newValue) { diff --git a/ShadowEditor.Web/src/command/SetMaterialColorCommand.js b/ShadowEditor.Web/src/command/SetMaterialColorCommand.js index 8db7c2a9..67dcf125 100644 --- a/ShadowEditor.Web/src/command/SetMaterialColorCommand.js +++ b/ShadowEditor.Web/src/command/SetMaterialColorCommand.js @@ -6,9 +6,9 @@ let color = new THREE.Color(); * 设置材质颜色命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param attributeName string - * @param newValue integer representing a hex color value or a hex string startsWith `#` + * @param {THREE.Object3D} object 物体 + * @param {String} attributeName 属性名称 + * @param {String} newValue integer representing a hex color value or a hex string startsWith `#` * @constructor */ function SetMaterialColorCommand(object, attributeName, newValue) { diff --git a/ShadowEditor.Web/src/command/SetMaterialCommand.js b/ShadowEditor.Web/src/command/SetMaterialCommand.js index 0d6586c9..c4994bb9 100644 --- a/ShadowEditor.Web/src/command/SetMaterialCommand.js +++ b/ShadowEditor.Web/src/command/SetMaterialCommand.js @@ -4,8 +4,8 @@ import Command from './Command'; * 设置材质命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param newMaterial THREE.Material + * @param {THREE.Object3D} object 物体 + * @param {THREE.Material} newMaterial 新材质 * @constructor */ function SetMaterialCommand(object, newMaterial) { diff --git a/ShadowEditor.Web/src/command/SetMaterialMapCommand.js b/ShadowEditor.Web/src/command/SetMaterialMapCommand.js index a4440507..4ae470f9 100644 --- a/ShadowEditor.Web/src/command/SetMaterialMapCommand.js +++ b/ShadowEditor.Web/src/command/SetMaterialMapCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 设置材质纹理命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param mapName string - * @param newMap THREE.Texture + * @param {THREE.Object3D} object 物体 + * @param {String} mapName 属性名称 + * @param {THREE.Texture} newMap 新纹理 * @constructor */ function SetMaterialMapCommand(object, mapName, newMap) { diff --git a/ShadowEditor.Web/src/command/SetMaterialValueCommand.js b/ShadowEditor.Web/src/command/SetMaterialValueCommand.js index 76643a73..13ca91cc 100644 --- a/ShadowEditor.Web/src/command/SetMaterialValueCommand.js +++ b/ShadowEditor.Web/src/command/SetMaterialValueCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 设置材质值命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param attributeName string - * @param newValue number, string, boolean or object + * @param {THREE.Object3D} object 物体 + * @param {String} attributeName 属性名称 + * @param {String} newValue number, string, boolean or object * @constructor */ function SetMaterialValueCommand(object, attributeName, newValue) { diff --git a/ShadowEditor.Web/src/command/SetPositionCommand.js b/ShadowEditor.Web/src/command/SetPositionCommand.js index a50480cf..91217785 100644 --- a/ShadowEditor.Web/src/command/SetPositionCommand.js +++ b/ShadowEditor.Web/src/command/SetPositionCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 设置位置命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param newPosition THREE.Vector3 - * @param optionalOldPosition THREE.Vector3 + * @param {THREE.Object3D} object 物体 + * @param {THREE.Vector3} newPosition 新位置 + * @param {THREE.Vector3} optionalOldPosition 可选旧位置 * @constructor */ function SetPositionCommand(object, newPosition, optionalOldPosition) { diff --git a/ShadowEditor.Web/src/command/SetRotationCommand.js b/ShadowEditor.Web/src/command/SetRotationCommand.js index 190b2052..d3c9fffd 100644 --- a/ShadowEditor.Web/src/command/SetRotationCommand.js +++ b/ShadowEditor.Web/src/command/SetRotationCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 设置旋转命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param newRotation THREE.Euler - * @param optionalOldRotation THREE.Euler + * @param {THREE.Object3D} object 物体 + * @param {THREE.Euler} newRotation 新欧拉角 + * @param {THREE.Euler} optionalOldRotation 可选旧欧拉角 * @constructor */ function SetRotationCommand(object, newRotation, optionalOldRotation) { diff --git a/ShadowEditor.Web/src/command/SetScaleCommand.js b/ShadowEditor.Web/src/command/SetScaleCommand.js index 49366b46..bb0ceba0 100644 --- a/ShadowEditor.Web/src/command/SetScaleCommand.js +++ b/ShadowEditor.Web/src/command/SetScaleCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 设置缩放命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param newScale THREE.Vector3 - * @param optionalOldScale THREE.Vector3 + * @param {THREE.Object3D} object 物体 + * @param {THREE.Vector3} newScale 新缩放 + * @param {THREE.Vector3} optionalOldScale 可选旧缩放 * @constructor */ function SetScaleCommand(object, newScale, optionalOldScale) { diff --git a/ShadowEditor.Web/src/command/SetSceneCommand.js b/ShadowEditor.Web/src/command/SetSceneCommand.js index 86910552..b41801da 100644 --- a/ShadowEditor.Web/src/command/SetSceneCommand.js +++ b/ShadowEditor.Web/src/command/SetSceneCommand.js @@ -7,7 +7,7 @@ import AddObjectCommand from './AddObjectCommand'; * 设置场景命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param scene containing children to import + * @param {THREE.Scene} scene containing children to import * @constructor */ function SetSceneCommand(scene) { diff --git a/ShadowEditor.Web/src/command/SetScriptValueCommand.js b/ShadowEditor.Web/src/command/SetScriptValueCommand.js index db876cc7..3b2099dd 100644 --- a/ShadowEditor.Web/src/command/SetScriptValueCommand.js +++ b/ShadowEditor.Web/src/command/SetScriptValueCommand.js @@ -4,12 +4,12 @@ import Command from './Command'; * 设置脚本值命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param script javascript object - * @param attributeName string - * @param newValue string, object - * @param cursorPosition javascript object with format {line: 2, ch: 3} - * @param scrollInfo javascript object with values {left, top, width, height, clientWidth, clientHeight} + * @param {THREE.Object3D} object THREE.Object3D + * @param {String} script javascript object + * @param {String} attributeName string + * @param {Object} newValue string, object + * @param {Object} cursorPosition javascript object with format {line: 2, ch: 3} + * @param {Object} scrollInfo javascript object with values {left, top, width, height, clientWidth, clientHeight} * @constructor */ function SetScriptValueCommand(object, script, attributeName, newValue, cursorPosition, scrollInfo) { diff --git a/ShadowEditor.Web/src/command/SetUuidCommand.js b/ShadowEditor.Web/src/command/SetUuidCommand.js index 1fb8c5d0..da5cd33c 100644 --- a/ShadowEditor.Web/src/command/SetUuidCommand.js +++ b/ShadowEditor.Web/src/command/SetUuidCommand.js @@ -4,8 +4,8 @@ import Command from './Command'; * 设置uuid命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param newUuid string + * @param {THREE.Object3D} object 物体 + * @param {String} newUuid 新的UUID * @constructor */ function SetUuidCommand(object, newUuid) { diff --git a/ShadowEditor.Web/src/command/SetValueCommand.js b/ShadowEditor.Web/src/command/SetValueCommand.js index 658ee056..43bcbc51 100644 --- a/ShadowEditor.Web/src/command/SetValueCommand.js +++ b/ShadowEditor.Web/src/command/SetValueCommand.js @@ -4,9 +4,9 @@ import Command from './Command'; * 设置值命令 * @author dforrer / https://github.com/dforrer * Developed as part of a project at University of Applied Sciences and Arts Northwestern Switzerland (www.fhnw.ch) - * @param object THREE.Object3D - * @param attributeName string - * @param newValue number, string, boolean or object + * @param {THREE.Object3D} object 物体 + * @param {String} attributeName 属性名称 + * @param {String} newValue number, string, boolean or object * @constructor */ function SetValueCommand(object, attributeName, newValue) { diff --git a/ShadowEditor.Web/src/controls/OrthographicCameraControls.js b/ShadowEditor.Web/src/controls/OrthographicCameraControls.js index cfb92c98..979b4451 100644 --- a/ShadowEditor.Web/src/controls/OrthographicCameraControls.js +++ b/ShadowEditor.Web/src/controls/OrthographicCameraControls.js @@ -55,7 +55,7 @@ OrthographicCameraControls.prototype.onMouseMove = function (event) { return; } - let camera = this.camera; + // let camera = this.camera; let width = this.domElement.clientWidth; let height = this.domElement.clientHeight; @@ -73,7 +73,7 @@ OrthographicCameraControls.prototype.onMouseMove = function (event) { this.offsetXY.set(event.offsetX, event.offsetY); }; -OrthographicCameraControls.prototype.onMouseUp = function (event) { +OrthographicCameraControls.prototype.onMouseUp = function () { this.isDown = false; }; diff --git a/ShadowEditor.Web/src/event/PhysicsEvent.js b/ShadowEditor.Web/src/event/PhysicsEvent.js index 70eb9f6c..16c9e8c9 100644 --- a/ShadowEditor.Web/src/event/PhysicsEvent.js +++ b/ShadowEditor.Web/src/event/PhysicsEvent.js @@ -159,7 +159,7 @@ PhysicsEngine.prototype.updatePhysicsWorld = function () { PhysicsEngine.prototype.createRigidBody = function (obj) { let position = obj.position; let quaternion = obj.quaternion; - let scale = obj.scale; + // let scale = obj.scale; let physics = obj.userData.physics; let shape = physics.shape; diff --git a/ShadowEditor.Web/src/event/visual/DraggableEvent.js b/ShadowEditor.Web/src/event/visual/DraggableEvent.js index d1eeb1ff..b7b7f9ea 100644 --- a/ShadowEditor.Web/src/event/visual/DraggableEvent.js +++ b/ShadowEditor.Web/src/event/visual/DraggableEvent.js @@ -3,10 +3,9 @@ import BaseEvent from '../BaseEvent'; /** * 拖动事件 * @author tengge / https://github.com/tengge1 - * @param {*} app */ -function DraggableEvent(app) { - BaseEvent.call(this, app); +function DraggableEvent() { + BaseEvent.call(this); } DraggableEvent.prototype = Object.create(BaseEvent.prototype); diff --git a/ShadowEditor.Web/src/gis/render/Renderers.js b/ShadowEditor.Web/src/gis/render/Renderers.js index 3e0a951b..686b7d75 100644 --- a/ShadowEditor.Web/src/gis/render/Renderers.js +++ b/ShadowEditor.Web/src/gis/render/Renderers.js @@ -2,7 +2,7 @@ import Renderer from './Renderer'; import BackgroundRenderer from './BackgroundRenderer'; import SunRenderer from './SunRenderer'; import TiledLayerRenderer from './TiledLayerRenderer'; -import AtmosphereRenderer from './AtmosphereRenderer'; +// import AtmosphereRenderer from './AtmosphereRenderer'; /** * 所有渲染器 diff --git a/ShadowEditor.Web/src/gis/render/SunRenderer.js b/ShadowEditor.Web/src/gis/render/SunRenderer.js index f530db75..70d83eea 100644 --- a/ShadowEditor.Web/src/gis/render/SunRenderer.js +++ b/ShadowEditor.Web/src/gis/render/SunRenderer.js @@ -1,7 +1,7 @@ import Renderer from './Renderer'; import SunVertex from './shader/sun_vertex.glsl'; import SunFragment from './shader/sun_fragment.glsl'; -import WGS84 from '../core/WGS84'; +// import WGS84 from '../core/WGS84'; /** * 太阳渲染器 diff --git a/ShadowEditor.Web/src/gis/render/TiledLayerRenderer.js b/ShadowEditor.Web/src/gis/render/TiledLayerRenderer.js index 553305e2..6cb0e0ee 100644 --- a/ShadowEditor.Web/src/gis/render/TiledLayerRenderer.js +++ b/ShadowEditor.Web/src/gis/render/TiledLayerRenderer.js @@ -2,7 +2,7 @@ import Renderer from './Renderer'; import SphereTileCreator from '../tile/SphereTileCreator'; import TiledVertex from './shader/tiled_vertex.glsl'; import TiledFragment from './shader/tiled_fragment.glsl'; -import WGS84 from '../core/WGS84'; +// import WGS84 from '../core/WGS84'; /** * 瓦片图层渲染器 diff --git a/ShadowEditor.Web/src/gis/tile/Tile.js b/ShadowEditor.Web/src/gis/tile/Tile.js index a04d1b0d..fd8d32eb 100644 --- a/ShadowEditor.Web/src/gis/tile/Tile.js +++ b/ShadowEditor.Web/src/gis/tile/Tile.js @@ -1,4 +1,4 @@ -import WGS84 from '../core/WGS84'; +// import WGS84 from '../core/WGS84'; import GeoUtils from '../utils/GeoUtils'; /** diff --git a/ShadowEditor.Web/src/object/component/Water.js b/ShadowEditor.Web/src/object/component/Water.js index 6af5c413..43188c3e 100644 --- a/ShadowEditor.Web/src/object/component/Water.js +++ b/ShadowEditor.Web/src/object/component/Water.js @@ -1,5 +1,5 @@ import HeightmapFragmentShader from './shader/heightmap_fragment.glsl'; -import SmoothFragmentShader from './shader/smooth_fragment.glsl'; +// import SmoothFragmentShader from './shader/smooth_fragment.glsl'; import WaterVertexShader from './shader/water_vertex.glsl'; /** @@ -76,11 +76,11 @@ function Water(renderer) { console.error(error); } - var smoothShader = gpuCompute.createShaderMaterial(SmoothFragmentShader, { - texture: { - value: null - } - }); + // var smoothShader = gpuCompute.createShaderMaterial(SmoothFragmentShader, { + // texture: { + // value: null + // } + // }); this.heightmapVariable = heightmapVariable; this.gpuCompute = gpuCompute; @@ -99,7 +99,7 @@ Water.prototype.fillTexture = function (texture, WIDTH) { var waterMaxHeight = 30; - function noise(x, y, z) { + function noise(x, y) { var multR = waterMaxHeight; var mult = 0.025; var r = 0; diff --git a/ShadowEditor.Web/src/player/component/physics/ThrowBallEvent.js b/ShadowEditor.Web/src/player/component/physics/ThrowBallEvent.js index 3cb22475..1205e393 100644 --- a/ShadowEditor.Web/src/player/component/physics/ThrowBallEvent.js +++ b/ShadowEditor.Web/src/player/component/physics/ThrowBallEvent.js @@ -3,8 +3,8 @@ import PlayerComponent from '../PlayerComponent'; /** * 按z键扔球事件 * @param {*} app 播放器 - * @param {*} world - * @param {*} rigidBodies + * @param {*} world 物理世界 + * @param {*} rigidBodies 刚体 */ function ThrowBallEvent(app, world, rigidBodies) { PlayerComponent.call(this, app); diff --git a/ShadowEditor.Web/src/render/extension/ANGLE_instanced_arrays.js b/ShadowEditor.Web/src/render/extension/ANGLE_instanced_arrays.js index 45ea3ba7..c7ae927a 100644 --- a/ShadowEditor.Web/src/render/extension/ANGLE_instanced_arrays.js +++ b/ShadowEditor.Web/src/render/extension/ANGLE_instanced_arrays.js @@ -2,7 +2,8 @@ * The ANGLE_instanced_arrays extension is part of the WebGL API and * allows to draw the same object, or groups of similar objects multiple * times, if they share the same vertex data, primitive count and type. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/ANGLE_instanced_arrays */ function ANGLE_instanced_arrays(gl) { diff --git a/ShadowEditor.Web/src/render/extension/EXT_blend_minmax.js b/ShadowEditor.Web/src/render/extension/EXT_blend_minmax.js index 7614a470..927fa454 100644 --- a/ShadowEditor.Web/src/render/extension/EXT_blend_minmax.js +++ b/ShadowEditor.Web/src/render/extension/EXT_blend_minmax.js @@ -2,7 +2,8 @@ * The EXT_blend_minmax extension is part of the WebGL API and * extends blending capabilities by adding two new blend equations: * the minimum or maximum color components of the source and destination colors. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_blend_minmax */ function EXT_blend_minmax(gl) { diff --git a/ShadowEditor.Web/src/render/extension/EXT_color_buffer_half_float.js b/ShadowEditor.Web/src/render/extension/EXT_color_buffer_half_float.js index 6f32a874..3e48cedc 100644 --- a/ShadowEditor.Web/src/render/extension/EXT_color_buffer_half_float.js +++ b/ShadowEditor.Web/src/render/extension/EXT_color_buffer_half_float.js @@ -1,7 +1,8 @@ /** * The EXT_color_buffer_half_float extension is part of the WebGL API and * adds the ability to render to 16-bit floating-point color buffers. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_color_buffer_half_float */ function EXT_color_buffer_half_float(gl) { diff --git a/ShadowEditor.Web/src/render/extension/EXT_disjoint_timer_query.js b/ShadowEditor.Web/src/render/extension/EXT_disjoint_timer_query.js index 59639762..0e310905 100644 --- a/ShadowEditor.Web/src/render/extension/EXT_disjoint_timer_query.js +++ b/ShadowEditor.Web/src/render/extension/EXT_disjoint_timer_query.js @@ -2,7 +2,8 @@ * The EXT_disjoint_timer_query extension is part of the WebGL API and * provides a way to measure the duration of a set of GL commands, without * stalling the rendering pipeline. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_disjoint_timer_query */ function EXT_disjoint_timer_query(gl) { diff --git a/ShadowEditor.Web/src/render/extension/EXT_frag_depth.js b/ShadowEditor.Web/src/render/extension/EXT_frag_depth.js index a374006f..59e68355 100644 --- a/ShadowEditor.Web/src/render/extension/EXT_frag_depth.js +++ b/ShadowEditor.Web/src/render/extension/EXT_frag_depth.js @@ -2,7 +2,8 @@ * The EXT_frag_depth extension is part of the WebGL API and * enables to set a depth value of a fragment from within the * fragment shader. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_frag_depth */ function EXT_frag_depth(gl) { diff --git a/ShadowEditor.Web/src/render/extension/EXT_sRGB.js b/ShadowEditor.Web/src/render/extension/EXT_sRGB.js index 243fbb67..d29e133d 100644 --- a/ShadowEditor.Web/src/render/extension/EXT_sRGB.js +++ b/ShadowEditor.Web/src/render/extension/EXT_sRGB.js @@ -1,7 +1,8 @@ /** * The EXT_sRGB extension is part of the WebGL API and * adds sRGB support to textures and framebuffer objects. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_sRGB */ function EXT_sRGB(gl) { diff --git a/ShadowEditor.Web/src/render/extension/EXT_shader_texture_lod.js b/ShadowEditor.Web/src/render/extension/EXT_shader_texture_lod.js index 39722e12..f5f1b684 100644 --- a/ShadowEditor.Web/src/render/extension/EXT_shader_texture_lod.js +++ b/ShadowEditor.Web/src/render/extension/EXT_shader_texture_lod.js @@ -2,7 +2,8 @@ * The EXT_shader_texture_lod extension is part of the WebGL API and * adds additional texture functions to the OpenGL ES Shading Language * which provide the shader writer with explicit control of LOD (Level of detail). - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_shader_texture_lod */ function EXT_shader_texture_lod(gl) { diff --git a/ShadowEditor.Web/src/render/extension/EXT_texture_filter_anisotropic.js b/ShadowEditor.Web/src/render/extension/EXT_texture_filter_anisotropic.js index 212bb2e1..07b87c61 100644 --- a/ShadowEditor.Web/src/render/extension/EXT_texture_filter_anisotropic.js +++ b/ShadowEditor.Web/src/render/extension/EXT_texture_filter_anisotropic.js @@ -1,7 +1,8 @@ /** * The EXT_texture_filter_anisotropic extension is part of the WebGL API and * exposes two constants for anisotropic filtering (AF). - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_texture_filter_anisotropic */ function EXT_texture_filter_anisotropic(gl) { diff --git a/ShadowEditor.Web/src/render/extension/OES_element_index_uint.js b/ShadowEditor.Web/src/render/extension/OES_element_index_uint.js index b0e399f8..cf95d701 100644 --- a/ShadowEditor.Web/src/render/extension/OES_element_index_uint.js +++ b/ShadowEditor.Web/src/render/extension/OES_element_index_uint.js @@ -1,7 +1,8 @@ /** * The OES_element_index_uint extension is part of the WebGL API and * adds support for gl.UNSIGNED_INT types to WebGLRenderingContext.drawElements(). - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/OES_element_index_uint */ function OES_element_index_uint(gl) { diff --git a/ShadowEditor.Web/src/render/extension/OES_standard_derivatives.js b/ShadowEditor.Web/src/render/extension/OES_standard_derivatives.js index 8624320c..17c011ef 100644 --- a/ShadowEditor.Web/src/render/extension/OES_standard_derivatives.js +++ b/ShadowEditor.Web/src/render/extension/OES_standard_derivatives.js @@ -1,7 +1,8 @@ /** * The OES_standard_derivatives extension is part of the WebGL API and * adds the GLSL derivative functions dFdx, dFdy, and fwidth. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/OES_standard_derivatives */ function OES_standard_derivatives(gl) { diff --git a/ShadowEditor.Web/src/render/extension/OES_texture_float.js b/ShadowEditor.Web/src/render/extension/OES_texture_float.js index 190151e8..1205ea16 100644 --- a/ShadowEditor.Web/src/render/extension/OES_texture_float.js +++ b/ShadowEditor.Web/src/render/extension/OES_texture_float.js @@ -1,7 +1,8 @@ /** * The OES_texture_float extension is part of the WebGL API and * exposes floating-point pixel types for textures. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_float */ function OES_texture_float(gl) { diff --git a/ShadowEditor.Web/src/render/extension/OES_texture_float_linear.js b/ShadowEditor.Web/src/render/extension/OES_texture_float_linear.js index 845e85b1..df452094 100644 --- a/ShadowEditor.Web/src/render/extension/OES_texture_float_linear.js +++ b/ShadowEditor.Web/src/render/extension/OES_texture_float_linear.js @@ -1,7 +1,8 @@ /** * The OES_texture_float_linear extension is part of the WebGL API and * allows linear filtering with floating-point pixel types for textures. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_float_linear */ function OES_texture_float_linear(gl) { diff --git a/ShadowEditor.Web/src/render/extension/OES_texture_half_float.js b/ShadowEditor.Web/src/render/extension/OES_texture_half_float.js index 7840f926..1bd9af87 100644 --- a/ShadowEditor.Web/src/render/extension/OES_texture_half_float.js +++ b/ShadowEditor.Web/src/render/extension/OES_texture_half_float.js @@ -2,7 +2,8 @@ * The OES_texture_half_float extension is part of the WebGL API and * adds texture formats with 16- (aka half float) and 32-bit floating-point * components. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_half_float */ function OES_texture_half_float(gl) { diff --git a/ShadowEditor.Web/src/render/extension/OES_texture_half_float_linear.js b/ShadowEditor.Web/src/render/extension/OES_texture_half_float_linear.js index 462a7c1b..996ad00c 100644 --- a/ShadowEditor.Web/src/render/extension/OES_texture_half_float_linear.js +++ b/ShadowEditor.Web/src/render/extension/OES_texture_half_float_linear.js @@ -1,7 +1,8 @@ /** * The OES_texture_half_float_linear extension is part of the WebGL API and * allows linear filtering with half floating-point pixel types for textures. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_half_float_linear */ function OES_texture_half_float_linear(gl) { diff --git a/ShadowEditor.Web/src/render/extension/OES_vertex_array_object.js b/ShadowEditor.Web/src/render/extension/OES_vertex_array_object.js index 3feec0cb..081a86c9 100644 --- a/ShadowEditor.Web/src/render/extension/OES_vertex_array_object.js +++ b/ShadowEditor.Web/src/render/extension/OES_vertex_array_object.js @@ -3,7 +3,8 @@ * provides vertex array objects (VAOs) which encapsulate vertex array states. * These objects keep pointers to vertex data and provide names for different * sets of vertex data. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/OES_vertex_array_object */ function OES_vertex_array_object(gl) { diff --git a/ShadowEditor.Web/src/render/extension/WEBGL_color_buffer_float.js b/ShadowEditor.Web/src/render/extension/WEBGL_color_buffer_float.js index 6d258b43..551cec89 100644 --- a/ShadowEditor.Web/src/render/extension/WEBGL_color_buffer_float.js +++ b/ShadowEditor.Web/src/render/extension/WEBGL_color_buffer_float.js @@ -1,7 +1,8 @@ /** * The WEBGL_color_buffer_float extension is part of the WebGL API and * adds the ability to render to 32-bit floating-point color buffers. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_color_buffer_float */ function WEBGL_color_buffer_float(gl) { diff --git a/ShadowEditor.Web/src/render/extension/WEBGL_compressed_texture_s3tc.js b/ShadowEditor.Web/src/render/extension/WEBGL_compressed_texture_s3tc.js index 913a8b48..0d2e1f01 100644 --- a/ShadowEditor.Web/src/render/extension/WEBGL_compressed_texture_s3tc.js +++ b/ShadowEditor.Web/src/render/extension/WEBGL_compressed_texture_s3tc.js @@ -1,7 +1,8 @@ /** * The WEBGL_compressed_texture_s3tc extension is part of the WebGL API and * exposes four S3TC compressed texture formats. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_compressed_texture_s3tc */ function WEBGL_compressed_texture_s3tc(gl) { diff --git a/ShadowEditor.Web/src/render/extension/WEBGL_compressed_texture_s3tc_srgb.js b/ShadowEditor.Web/src/render/extension/WEBGL_compressed_texture_s3tc_srgb.js index b1fe2d65..2620d3fd 100644 --- a/ShadowEditor.Web/src/render/extension/WEBGL_compressed_texture_s3tc_srgb.js +++ b/ShadowEditor.Web/src/render/extension/WEBGL_compressed_texture_s3tc_srgb.js @@ -1,7 +1,8 @@ /** * The WEBGL_compressed_texture_s3tc_srgb extension is part of the WebGL API and * exposes four S3TC compressed texture formats for the sRGB colorspace. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_compressed_texture_s3tc_srgb */ function WEBGL_compressed_texture_s3tc_srgb(gl) { diff --git a/ShadowEditor.Web/src/render/extension/WEBGL_debug_renderer_info.js b/ShadowEditor.Web/src/render/extension/WEBGL_debug_renderer_info.js index 8f39aa66..b0fec9e3 100644 --- a/ShadowEditor.Web/src/render/extension/WEBGL_debug_renderer_info.js +++ b/ShadowEditor.Web/src/render/extension/WEBGL_debug_renderer_info.js @@ -2,7 +2,8 @@ * The WEBGL_debug_renderer_info extension is part of the WebGL API and * exposes two constants with information about the graphics driver for * debugging purposes. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info */ function WEBGL_debug_renderer_info(gl) { diff --git a/ShadowEditor.Web/src/render/extension/WEBGL_debug_shaders.js b/ShadowEditor.Web/src/render/extension/WEBGL_debug_shaders.js index 7712e401..07bb69ef 100644 --- a/ShadowEditor.Web/src/render/extension/WEBGL_debug_shaders.js +++ b/ShadowEditor.Web/src/render/extension/WEBGL_debug_shaders.js @@ -1,7 +1,8 @@ /** * The WEBGL_debug_shaders extension is part of the WebGL API and * exposes a method to debug shaders from privileged contexts. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_shaders */ function WEBGL_debug_shaders(gl) { diff --git a/ShadowEditor.Web/src/render/extension/WEBGL_depth_texture.js b/ShadowEditor.Web/src/render/extension/WEBGL_depth_texture.js index 01491b2f..856422c3 100644 --- a/ShadowEditor.Web/src/render/extension/WEBGL_depth_texture.js +++ b/ShadowEditor.Web/src/render/extension/WEBGL_depth_texture.js @@ -1,7 +1,8 @@ /** * The WEBGL_depth_texture extension is part of the WebGL API and * defines 2D depth and depth-stencil textures. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_depth_texture */ function WEBGL_depth_texture(gl) { diff --git a/ShadowEditor.Web/src/render/extension/WEBGL_draw_buffers.js b/ShadowEditor.Web/src/render/extension/WEBGL_draw_buffers.js index b69a3152..d91ed854 100644 --- a/ShadowEditor.Web/src/render/extension/WEBGL_draw_buffers.js +++ b/ShadowEditor.Web/src/render/extension/WEBGL_draw_buffers.js @@ -2,7 +2,8 @@ * The WEBGL_draw_buffers extension is part of the WebGL API and * enables a fragment shader to write to several textures, which * is useful for deferred shading, for example. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_draw_buffers */ function WEBGL_draw_buffers(gl) { diff --git a/ShadowEditor.Web/src/render/extension/WEBGL_lose_context.js b/ShadowEditor.Web/src/render/extension/WEBGL_lose_context.js index 9c91056e..f447adab 100644 --- a/ShadowEditor.Web/src/render/extension/WEBGL_lose_context.js +++ b/ShadowEditor.Web/src/render/extension/WEBGL_lose_context.js @@ -1,7 +1,8 @@ /** * The WEBGL_lose_context extension is part of the WebGL API and * exposes functions to simulate losing and restoring a WebGLRenderingContext. - * @param {*} gl + * @param {*} gl WebGL + * @returns {*} Extension * @see https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context */ function WEBGL_lose_context(gl) { diff --git a/ShadowEditor.Web/src/visual/BaseComponent.js b/ShadowEditor.Web/src/visual/BaseComponent.js index 5b7dfb61..22805b5f 100644 --- a/ShadowEditor.Web/src/visual/BaseComponent.js +++ b/ShadowEditor.Web/src/visual/BaseComponent.js @@ -19,7 +19,7 @@ BaseComponent.prototype.setTranslate = null; * 渲染组件 * @param {SVGElement} parent 父组件 */ -BaseComponent.prototype.render = function (parent) { +BaseComponent.prototype.render = function (parent) { // eslint-disable-line }; @@ -34,7 +34,7 @@ BaseComponent.prototype.toJSON = function () { * json转组件 * @param {Object} json JSON字符串反序列化后的对象 */ -BaseComponent.prototype.fromJSON = function (json) { +BaseComponent.prototype.fromJSON = function (json) { // eslint-disable-line }; diff --git a/ShadowEditor.Web/src/visual/component/ChordGraph.js b/ShadowEditor.Web/src/visual/component/ChordGraph.js index 11bb02fc..f993a5f2 100644 --- a/ShadowEditor.Web/src/visual/component/ChordGraph.js +++ b/ShadowEditor.Web/src/visual/component/ChordGraph.js @@ -155,8 +155,8 @@ ChordGraph.prototype.render = function (parent) { return function (g, i) { gInner.selectAll('.innerPath') .filter(function (d) { - return d.source.index != i && - d.target.index != i; + return d.source.index !== i && + d.target.index !== i; }) .transition() .style('opacity', opacity); diff --git a/ShadowEditor.Web/src/visual/component/Histogram.js b/ShadowEditor.Web/src/visual/component/Histogram.js index 249d3038..1af08582 100644 --- a/ShadowEditor.Web/src/visual/component/Histogram.js +++ b/ShadowEditor.Web/src/visual/component/Histogram.js @@ -68,7 +68,7 @@ Histogram.prototype.render = function (parent) { .attr('y', function (d) { return 133.6 - d; }) - .attr('width', function (d) { + .attr('width', function () { return 10; }) .attr('height', function (d) { diff --git a/ShadowEditor.Web/src/visual/component/Histogram2.js b/ShadowEditor.Web/src/visual/component/Histogram2.js index b71a397a..93e91d9e 100644 --- a/ShadowEditor.Web/src/visual/component/Histogram2.js +++ b/ShadowEditor.Web/src/visual/component/Histogram2.js @@ -61,7 +61,7 @@ Histogram2.prototype.render = function (parent) { .domain([0, d3.max(dataset)]) .range([0, yAxisWidth]); - var rect = g.selectAll('rect') + g.selectAll('rect') .data(dataset) .enter() .append('rect') @@ -78,7 +78,7 @@ Histogram2.prototype.render = function (parent) { return yScale(d); }); - var text = g.selectAll('text') + g.selectAll('text') .data(dataset) .enter() .append('text') diff --git a/ShadowEditor.Web/src/visual/component/PackDiagram.js b/ShadowEditor.Web/src/visual/component/PackDiagram.js index ea421a3a..9f006990 100644 --- a/ShadowEditor.Web/src/visual/component/PackDiagram.js +++ b/ShadowEditor.Web/src/visual/component/PackDiagram.js @@ -79,7 +79,7 @@ PackDiagram.prototype.render = function (parent) { var pack = d3.pack() .size([width, height]) - .radius(function (d) { + .radius(function () { return 30; }) .padding(5); diff --git a/ShadowEditor.Web/src/visual/component/PartitionDiagram.js b/ShadowEditor.Web/src/visual/component/PartitionDiagram.js index e575ffc8..b8fb9afd 100644 --- a/ShadowEditor.Web/src/visual/component/PartitionDiagram.js +++ b/ShadowEditor.Web/src/visual/component/PartitionDiagram.js @@ -89,8 +89,8 @@ PartitionDiagram.prototype.render = function (parent) { }] }; - var width = 800; - var height = 500; + // var width = 800; + // var height = 500; var hierarchy = d3.hierarchy(city); diff --git a/ShadowEditor.Web/src/visual/component/ScatterPlot.js b/ShadowEditor.Web/src/visual/component/ScatterPlot.js index 8db8d2a5..ee480fe7 100644 --- a/ShadowEditor.Web/src/visual/component/ScatterPlot.js +++ b/ShadowEditor.Web/src/visual/component/ScatterPlot.js @@ -86,10 +86,10 @@ ScatterPlot.prototype.render = function (parent) { left: 40 }; - var width = xAxisWidth + padding.left + padding.right; + // var width = xAxisWidth + padding.left + padding.right; var height = yAxisWidth + padding.top + padding.bottom; - var circle = g.selectAll('circle') + g.selectAll('circle') .data(center) .enter() .append('circle') diff --git a/ShadowEditor.Web/src/visual/demo/BarChart.js b/ShadowEditor.Web/src/visual/demo/BarChart.js index 3f55d22b..cf58e9c5 100644 --- a/ShadowEditor.Web/src/visual/demo/BarChart.js +++ b/ShadowEditor.Web/src/visual/demo/BarChart.js @@ -2,7 +2,7 @@ import Component from './Component'; /** * 条形图 - * @param {*} options + * @param {*} options 配置 */ function BarChart(options) { Component.call(this, options); diff --git a/ShadowEditor.Web/src/visual/demo/Panel.js b/ShadowEditor.Web/src/visual/demo/Panel.js index cd7e1fc5..34e6e833 100644 --- a/ShadowEditor.Web/src/visual/demo/Panel.js +++ b/ShadowEditor.Web/src/visual/demo/Panel.js @@ -2,7 +2,7 @@ import Component from './Component'; /** * 面板 - * @param {*} options + * @param {*} options 配置 */ function Panel(options) { Component.call(this, options); diff --git a/ShadowEditor.Web/src/visual/demo/Sidebar.js b/ShadowEditor.Web/src/visual/demo/Sidebar.js index 180a092d..ef49e5e6 100644 --- a/ShadowEditor.Web/src/visual/demo/Sidebar.js +++ b/ShadowEditor.Web/src/visual/demo/Sidebar.js @@ -2,7 +2,7 @@ import Component from './Component'; /** * 侧边栏 - * @param {*} options + * @param {*} options 配置 */ function Sidebar(options) { Component.call(this, options); @@ -70,12 +70,12 @@ Sidebar.prototype.render = function () { .attr('fill', 'none'); // 选项卡 - var tabDef = defs.append('path') + defs.append('path') .attr('id', 'tabDef') .attr('d', 'M0,0 L32,22 L32,60 L0,38 Z') .attr('fill', '#6c6f6e'); - var tabSelectDef = defs.append('path') + defs.append('path') .attr('id', 'tabSelectDef') .attr('d', 'M0,0 L32,22 L32,60 L0,38 Z') .attr('fill', '#356899'); @@ -299,7 +299,7 @@ Sidebar.prototype.render = function () { .attr('font-size', 14); // 中等面板 - var mediumPanelDef = defs.append('path') + defs.append('path') .attr('id', 'mediumPanelDef') .attr('d', 'M5,0 L160,0 L166,6 L166,33 L158,38 L158,91 L166,96 L166,125 L158,130 L5,130 L0,125 L0,96 L5,91 L5,36 L0,33 L0,6 Z') .attr('fill', 'rgba(0,0,0,0.5)'); @@ -510,7 +510,7 @@ Sidebar.prototype.render = function () { .attr('fill', 'rgba(0,0,0,0.5)'); // 标签 - var labelDef = defs.append('path') + defs.append('path') .attr('id', 'labelDef') .attr('d', 'M11,0 L72,0 L85,12 L72,24 L11,24 L0,12 Z') .attr('fill', 'rgba(23,29,48,0.5)'); @@ -535,7 +535,7 @@ Sidebar.prototype.render = function () { .attr('y', function (d) { return 133.6 - d; }) - .attr('width', function (d) { + .attr('width', function () { return 10; }) .attr('height', function (d) { @@ -601,7 +601,7 @@ Sidebar.prototype.render = function () { .attr('stroke-width', 2) .attr('fill', 'none'); - var label = linechart.append('g') + label = linechart.append('g') .attr('transform', 'translate(117,140)'); label.append('use') diff --git a/ShadowEditor.Web/src/visual/event/Drag.js b/ShadowEditor.Web/src/visual/event/Drag.js index de4b2d4b..8e901c66 100644 --- a/ShadowEditor.Web/src/visual/event/Drag.js +++ b/ShadowEditor.Web/src/visual/event/Drag.js @@ -1,5 +1,6 @@ /** * 通用拖动事件 + * @returns {Object} 拖动事件 */ function Drag() { var drag = d3.drag()