From 0e7670697edeea51385781aea2cc0b1420980e64 Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Tue, 19 Mar 2019 18:41:02 +0100 Subject: [PATCH 1/3] removes fps meter --- frontend/javascripts/oxalis/controller.js | 12 ++---------- .../viewmodes/arbitrary_controller.js | 4 ++++ .../controller/viewmodes/plane_controller.js | 4 ++++ .../test/puppeteer/dataset_rendering_helpers.js | 17 ----------------- frontend/stylesheets/main.less | 6 ------ package.json | 1 - yarn.lock | 5 ----- 7 files changed, 10 insertions(+), 39 deletions(-) diff --git a/frontend/javascripts/oxalis/controller.js b/frontend/javascripts/oxalis/controller.js index 6b0111883ee..1adf7162a83 100644 --- a/frontend/javascripts/oxalis/controller.js +++ b/frontend/javascripts/oxalis/controller.js @@ -8,7 +8,6 @@ import { Spin } from "antd"; 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"; @@ -53,7 +52,6 @@ type State = { class Controller extends React.PureComponent { keyboard: InputKeyboard; keyboardNoLoop: InputKeyboardNoLoop; - stats: Stats; isMounted: boolean; state = { @@ -129,10 +127,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(); @@ -259,8 +253,6 @@ class Controller extends React.PureComponent { }); } - updateStats = () => this.stats.update(); - render() { if (!this.state.ready) { return ( @@ -295,9 +287,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..39838708a84 100644 --- a/frontend/javascripts/oxalis/controller/viewmodes/arbitrary_controller.js +++ b/frontend/javascripts/oxalis/controller/viewmodes/arbitrary_controller.js @@ -77,6 +77,10 @@ class ArbitraryController extends React.PureComponent { listenTo: Function; stopListening: Function; + static defaultProps = { + onRender: () => {}, + }; + componentDidMount() { _.extend(this, BackboneEvents); this.input = { diff --git a/frontend/javascripts/oxalis/controller/viewmodes/plane_controller.js b/frontend/javascripts/oxalis/controller/viewmodes/plane_controller.js index ee239ff84f9..6327ed078b9 100644 --- a/frontend/javascripts/oxalis/controller/viewmodes/plane_controller.js +++ b/frontend/javascripts/oxalis/controller/viewmodes/plane_controller.js @@ -111,6 +111,10 @@ class PlaneController extends React.PureComponent { listenTo: Function; stopListening: Function; + static defaultProps = { + onRender: () => {}, + }; + constructor(...args: any) { super(...args); _.extend(this, BackboneEvents); 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 ec1f58f861d..aa894e21762 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 24b6f2ce359..07a6f6a7861 100644 --- a/package.json +++ b/package.json @@ -174,7 +174,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 44aff71f8e1..9f8daa0bcd9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10948,11 +10948,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" From 2143304f9da40cd634bedd45ba0b87ec219a012d Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Wed, 20 Mar 2019 10:51:29 +0100 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From eee0919affe5c251ef581b11d0ff79f72ac27c4b Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Wed, 20 Mar 2019 10:59:27 +0100 Subject: [PATCH 3/3] removes onRender entirely --- .../controller/viewmodes/arbitrary_controller.js | 7 ------- .../oxalis/controller/viewmodes/plane_controller.js | 12 ++---------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/frontend/javascripts/oxalis/controller/viewmodes/arbitrary_controller.js b/frontend/javascripts/oxalis/controller/viewmodes/arbitrary_controller.js index 39838708a84..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, |}; @@ -77,10 +76,6 @@ class ArbitraryController extends React.PureComponent { listenTo: Function; stopListening: Function; - static defaultProps = { - onRender: () => {}, - }; - componentDidMount() { _.extend(this, BackboneEvents); this.input = { @@ -279,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 6327ed078b9..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. @@ -111,10 +108,6 @@ class PlaneController extends React.PureComponent { listenTo: Function; stopListening: Function; - static defaultProps = { - onRender: () => {}, - }; - constructor(...args: any) { super(...args); _.extend(this, BackboneEvents); @@ -355,7 +348,6 @@ class PlaneController extends React.PureComponent { onPlaneViewRender(): void { getSceneController().update(); - this.props.onRender(); } movePlane = (v: Vector3, increaseSpeedWithZoom: boolean = true) => { @@ -601,4 +593,4 @@ export function mapStateToProps(state: OxalisState): StateProps { } export { PlaneController as PlaneControllerClass }; -export default connect(mapStateToProps)(PlaneController); +export default connect(mapStateToProps)(PlaneController);