MCPcopy Index your code
hub / github.com/codecombat/codecombat / initSurface

Method initSurface

app/views/play/SpectateView.js:272–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

270 // initialization
271
272 initSurface () {
273 const webGLSurface = $('canvas#webgl-surface', this.$el)
274 const normalSurface = $('canvas#normal-surface', this.$el)
275 this.surface = new Surface(this.world, normalSurface, webGLSurface, { thangTypes: this.supermodel.getModels(ThangType), spectateGame: true, playerNames: this.findPlayerNames(), levelType: this.level.get('type', true) })
276 const worldBounds = this.world.getBounds()
277 const bounds = [{ x: worldBounds.left, y: worldBounds.top }, { x: worldBounds.right, y: worldBounds.bottom }]
278 this.surface.camera.setBounds(bounds)
279 const zoom = () => {
280 return (this.surface != null ? this.surface.camera.zoomTo({ x: (worldBounds.right - worldBounds.left) / 2, y: (worldBounds.top - worldBounds.bottom) / 2 }, 0.1, 0) : undefined)
281 }
282 return _.delay(zoom, 4000) // call it later for some reason (TODO: figure this out)
283 }
284
285 findPlayerNames () {
286 const playerNames = {}

Callers 1

onLevelLoaderLoadedMethod · 0.95

Calls 2

findPlayerNamesMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected