Skip to content

Commit

Permalink
Removes fps meter (#3916)
Browse files Browse the repository at this point in the history
* removes fps meter

* changelog

* removes onRender entirely
  • Loading branch information
normanrz authored Mar 20, 2019
1 parent bceec98 commit 169b4e8
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 49 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions frontend/javascripts/oxalis/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,7 +53,6 @@ type State = {
class Controller extends React.PureComponent<PropsWithRouter, State> {
keyboard: InputKeyboard;
keyboardNoLoop: InputKeyboardNoLoop;
stats: Stats;
isMounted: boolean;

state = {
Expand Down Expand Up @@ -132,10 +130,6 @@ class Controller extends React.PureComponent<PropsWithRouter, State> {
UrlManager.startUrlUpdater();
initializeSceneController();

// FPS stats
this.stats = new Stats();
document.body.append(this.stats.domElement);

this.initKeyboard();
this.initTaskScript();

Expand Down Expand Up @@ -267,8 +261,6 @@ class Controller extends React.PureComponent<PropsWithRouter, State> {
});
}

updateStats = () => this.stats.update();

render() {
if (!this.state.ready) {
return <BrainSpinner />;
Expand All @@ -287,9 +279,9 @@ class Controller extends React.PureComponent<PropsWithRouter, State> {
const isPlane = constants.MODES_PLANE.includes(mode);

if (isArbitrary) {
return <ArbitraryController onRender={this.updateStats} viewMode={mode} />;
return <ArbitraryController viewMode={mode} />;
} else if (isPlane) {
return <PlaneController onRender={this.updateStats} />;
return <PlaneController />;
} 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import { downloadScreenshot } from "oxalis/view/rendering_utils";
const arbitraryViewportSelector = "#inputcatcher_arbitraryViewport";

type Props = {|
onRender: () => void,
viewMode: ViewMode,
|};

Expand Down Expand Up @@ -275,8 +274,6 @@ class ArbitraryController extends React.PureComponent<Props> {
}

bindToEvents(): void {
this.listenTo(this.arbitraryView, "render", this.props.onRender);

const onBucketLoaded = () => {
this.arbitraryView.draw();
app.vent.trigger("rerender");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Props> {
// See comment in Controller class on general controller architecture.
Expand Down Expand Up @@ -351,7 +348,6 @@ class PlaneController extends React.PureComponent<Props> {

onPlaneViewRender(): void {
getSceneController().update();
this.props.onRender();
}

movePlane = (v: Vector3, increaseSpeedWithZoom: boolean = true) => {
Expand Down Expand Up @@ -597,4 +593,4 @@ export function mapStateToProps(state: OxalisState): StateProps {
}

export { PlaneController as PlaneControllerClass };
export default connect<Props, OwnProps, _, _, _, _>(mapStateToProps)(PlaneController);
export default connect<Props, {||}, _, _, _, _>(mapStateToProps)(PlaneController);
17 changes: 0 additions & 17 deletions frontend/javascripts/test/puppeteer/dataset_rendering_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions frontend/stylesheets/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ td.nowrap * {
display: inline-block;
}

#stats {
position: fixed;
bottom: 0;
right: 0;
}

#credits {
max-width: 600px;
img {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 169b4e8

Please sign in to comment.