From 169b4e848ec429409aead6d2017fcb46293baa58 Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Wed, 20 Mar 2019 11:21:53 +0100 Subject: [PATCH] Removes fps meter (#3916) * removes fps meter * changelog * removes onRender entirely --- CHANGELOG.md | 2 +- frontend/javascripts/oxalis/controller.js | 12 ++---------- .../viewmodes/arbitrary_controller.js | 3 --- .../controller/viewmodes/plane_controller.js | 8 ++------ .../test/puppeteer/dataset_rendering_helpers.js | 17 ----------------- frontend/stylesheets/main.less | 6 ------ package.json | 1 - yarn.lock | 5 ----- 8 files changed, 5 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce75756c77d..7cee12807d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md). - Fixed interpolation along z-axis. [#3888](https://github.com/scalableminds/webknossos/pull/3888) ### Removed -- +- Removed FPS meter in Annotation View. [#3916](https://github.com/scalableminds/webknossos/pull/3916) ## [19.03.0](https://github.com/scalableminds/webknossos/releases/tag/19.03.0) - 2019-03-04 diff --git a/frontend/javascripts/oxalis/controller.js b/frontend/javascripts/oxalis/controller.js index 30450a069ca..1aeb5a3e12c 100644 --- a/frontend/javascripts/oxalis/controller.js +++ b/frontend/javascripts/oxalis/controller.js @@ -7,7 +7,6 @@ import { type RouterHistory, withRouter } from "react-router-dom"; import { connect } from "react-redux"; import BackboneEvents from "backbone-events-standalone"; import * as React from "react"; -import Stats from "stats.js"; import _ from "lodash"; import { HANDLED_ERROR } from "oxalis/model_initialization"; @@ -54,7 +53,6 @@ type State = { class Controller extends React.PureComponent { keyboard: InputKeyboard; keyboardNoLoop: InputKeyboardNoLoop; - stats: Stats; isMounted: boolean; state = { @@ -132,10 +130,6 @@ class Controller extends React.PureComponent { UrlManager.startUrlUpdater(); initializeSceneController(); - // FPS stats - this.stats = new Stats(); - document.body.append(this.stats.domElement); - this.initKeyboard(); this.initTaskScript(); @@ -267,8 +261,6 @@ class Controller extends React.PureComponent { }); } - updateStats = () => this.stats.update(); - render() { if (!this.state.ready) { return ; @@ -287,9 +279,9 @@ class Controller extends React.PureComponent { const isPlane = constants.MODES_PLANE.includes(mode); if (isArbitrary) { - return ; + return ; } else if (isPlane) { - return ; + return ; } else { // At the moment, all possible view modes consist of the union of MODES_ARBITRARY and MODES_PLANE // In case we add new viewmodes, the following error will be thrown. diff --git a/frontend/javascripts/oxalis/controller/viewmodes/arbitrary_controller.js b/frontend/javascripts/oxalis/controller/viewmodes/arbitrary_controller.js index 6bb00bb2f64..9cb335292ae 100644 --- a/frontend/javascripts/oxalis/controller/viewmodes/arbitrary_controller.js +++ b/frontend/javascripts/oxalis/controller/viewmodes/arbitrary_controller.js @@ -52,7 +52,6 @@ import { downloadScreenshot } from "oxalis/view/rendering_utils"; const arbitraryViewportSelector = "#inputcatcher_arbitraryViewport"; type Props = {| - onRender: () => void, viewMode: ViewMode, |}; @@ -275,8 +274,6 @@ class ArbitraryController extends React.PureComponent { } bindToEvents(): void { - this.listenTo(this.arbitraryView, "render", this.props.onRender); - const onBucketLoaded = () => { this.arbitraryView.draw(); app.vent.trigger("rerender"); diff --git a/frontend/javascripts/oxalis/controller/viewmodes/plane_controller.js b/frontend/javascripts/oxalis/controller/viewmodes/plane_controller.js index ee239ff84f9..9cd64557cb8 100644 --- a/frontend/javascripts/oxalis/controller/viewmodes/plane_controller.js +++ b/frontend/javascripts/oxalis/controller/viewmodes/plane_controller.js @@ -84,13 +84,10 @@ const isosurfaceLeftClick = (pos: Point2, plane: OrthoView, event: MouseEvent) = } }; -type OwnProps = {| - onRender: () => void, -|}; type StateProps = {| tracing: Tracing, |}; -type Props = {| ...OwnProps, ...StateProps |}; +type Props = {| ...StateProps |}; class PlaneController extends React.PureComponent { // See comment in Controller class on general controller architecture. @@ -351,7 +348,6 @@ class PlaneController extends React.PureComponent { onPlaneViewRender(): void { getSceneController().update(); - this.props.onRender(); } movePlane = (v: Vector3, increaseSpeedWithZoom: boolean = true) => { @@ -597,4 +593,4 @@ export function mapStateToProps(state: OxalisState): StateProps { } export { PlaneController as PlaneControllerClass }; -export default connect(mapStateToProps)(PlaneController); +export default connect(mapStateToProps)(PlaneController); diff --git a/frontend/javascripts/test/puppeteer/dataset_rendering_helpers.js b/frontend/javascripts/test/puppeteer/dataset_rendering_helpers.js index a8fe1057934..d0ad61d7f1f 100644 --- a/frontend/javascripts/test/puppeteer/dataset_rendering_helpers.js +++ b/frontend/javascripts/test/puppeteer/dataset_rendering_helpers.js @@ -43,20 +43,6 @@ export async function screenshotDataset( return openTracingViewAndScreenshot(page, baseUrl, createdExplorational.id, optionalViewOverride); } -function removeFpsMeter(page: Page) { - // The parameter to page.evaluate will be evaluated in the puppeteer browser context - // When supplying a js function instead of the template string, babel will mess with the code - // which may lead to errors (e.g.: _window is not defined) - // See https://github.com/GoogleChrome/puppeteer/issues/1665 - return page.evaluate(`() => { - const fpsMeter = document.querySelector("#stats"); - if (fpsMeter != null) { - const { parentNode } = fpsMeter; - if (parentNode != null) parentNode.removeChild(fpsMeter); - } - }`); -} - async function waitForTracingViewLoad(page: Page) { let inputCatchers; while (inputCatchers == null || inputCatchers.length < 4) { @@ -66,9 +52,6 @@ async function waitForTracingViewLoad(page: Page) { } async function waitForRenderingFinish(page: Page) { - // Remove the FPS meter as it will update even after the rendering is finished - await removeFpsMeter(page); - let currentShot; let lastShot = await page.screenshot({ fullPage: true }); let changedPixels = Infinity; diff --git a/frontend/stylesheets/main.less b/frontend/stylesheets/main.less index 27ae50a3117..b585febb3bb 100644 --- a/frontend/stylesheets/main.less +++ b/frontend/stylesheets/main.less @@ -92,12 +92,6 @@ td.nowrap * { display: inline-block; } -#stats { - position: fixed; - bottom: 0; - right: 0; -} - #credits { max-width: 600px; img { diff --git a/package.json b/package.json index c3eda10ca42..e4d02549eec 100644 --- a/package.json +++ b/package.json @@ -175,7 +175,6 @@ "react-virtualized": "^9.20.1", "redux": "^3.6.0", "redux-saga": "^0.16.0", - "stats.js": "^1.0.0", "three": "^0.87.0", "tween.js": "^16.3.1", "url-join": "^4.0.0", diff --git a/yarn.lock b/yarn.lock index bbd3620f8bf..50ae85170e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10953,11 +10953,6 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" -stats.js@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stats.js/-/stats.js-1.0.0.tgz#ca304e56b116a3f46413acc349eb6eee19df688e" - integrity sha1-yjBOVrEWo/RkE6zDSetu7hnfaI4= - "statuses@>= 1.4.0 < 2": version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"