From 72eb59b7c3f5a3f8bc41967fcdf7275aedfa40ec Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Mon, 1 Sep 2014 16:14:50 -0700 Subject: [PATCH] Fixed a few bugs. --- app/lib/surface/CocoSprite.coffee | 3 ++- app/lib/surface/Surface.coffee | 13 ++++++++----- app/lib/surface/WizardSprite.coffee | 1 + app/schemas/models/thang_type.coffee | 4 ++-- app/views/editor/level/thangs/ThangsTabView.coffee | 1 - 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index 478a71b0c..d0a192515 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -136,7 +136,8 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass width = @thang.width * Camera.PPM height = @thang.height * Camera.PPM * @options.camera.y2x depth = @thang.depth * Camera.PPM * @options.camera.z2y * @options.camera.y2x - makeColor = (brightnessFactor) => (Math.round(c * brightnessFactor) for c in (healthColors[@thang.team] ? [180, 180, 180])) + brightnessFuzzFactor = 1 + 0.1 * (Math.random() - 0.5) + makeColor = (brightnessFactor) => (Math.round(c * brightnessFuzzFactor * brightnessFactor) for c in (healthColors[@thang.team] ? [180, 180, 180])) topColor = "rgba(#{makeColor(0.85).join(', ')},1)" mainColor = "rgba(#{makeColor(0.75).join(', ')},1)" ellipse = @thang.shape in ['ellipsoid', 'disc'] diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index f15556120..a3762e125 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -428,15 +428,18 @@ module.exports = Surface = class Surface extends CocoClass pageHeight = $('#page-container').height() - $('#control-bar-view').outerHeight() - $('#playback-view').outerHeight() newWidth = Math.min pageWidth, pageHeight * aspectRatio newHeight = newWidth / aspectRatio + else if $('#editor-level-thangs-tab-view') + newWidth = $('#canvas-wrapper').width() + newHeight = newWidth / aspectRatio else newWidth = 0.55 * pageWidth newHeight = newWidth / aspectRatio - @canvas.width newWidth - @canvas.height newHeight return unless newWidth > 0 and newHeight > 0 - #if InstallTrigger? # Firefox rendering performance goes down as canvas size goes up - # newWidth = Math.min 924, newWidth - # newHeight = Math.min 589, newHeight + ##if InstallTrigger? # Firefox rendering performance goes down as canvas size goes up + ## newWidth = Math.min 924, newWidth + ## newHeight = Math.min 589, newHeight + #@canvas.width newWidth + #@canvas.height newHeight @canvas.attr width: newWidth, height: newHeight @stage.scaleX *= newWidth / oldWidth @stage.scaleY *= newHeight / oldHeight diff --git a/app/lib/surface/WizardSprite.coffee b/app/lib/surface/WizardSprite.coffee index d5bdfede2..21b3b453c 100644 --- a/app/lib/surface/WizardSprite.coffee +++ b/app/lib/surface/WizardSprite.coffee @@ -199,6 +199,7 @@ module.exports = class WizardSprite extends IndieSprite wizard.beginMoveTween() endMoveTween: => + return if @destroyed @thang.action = if @editing then 'cast' else 'idle' @thang.actionActivated = @thang.action is 'cast' @reachedTarget = true diff --git a/app/schemas/models/thang_type.coffee b/app/schemas/models/thang_type.coffee index 5b089d5cf..9ac0319c3 100644 --- a/app/schemas/models/thang_type.coffee +++ b/app/schemas/models/thang_type.coffee @@ -1,7 +1,7 @@ c = require './../schemas' ThangComponentSchema = require './thang_component' -ThangTypeSchema = c.object() +ThangTypeSchema = c.object default: {kind: 'Misc'} c.extendNamedProperties ThangTypeSchema # name first ShapeObjectSchema = c.object {title: 'Shape'}, @@ -144,7 +144,7 @@ _.extend ThangTypeSchema.properties, ThangTypeSchema.required = ['kind'] -ThangTypeSchema.default = +ThangTypeSchema.default = raw: {} ThangTypeSchema.definitions = diff --git a/app/views/editor/level/thangs/ThangsTabView.coffee b/app/views/editor/level/thangs/ThangsTabView.coffee index e54624ebb..282820873 100644 --- a/app/views/editor/level/thangs/ThangsTabView.coffee +++ b/app/views/editor/level/thangs/ThangsTabView.coffee @@ -318,7 +318,6 @@ module.exports = class ThangsTabView extends CocoView physicalConfig = {pos: {x: 10, y: 10, z: 1}} if physicalOriginal = _.find(defaultComponents ? [], original: componentOriginals['physics.Physical']) physicalConfig.pos.z = physicalOriginal.config?.pos?.z ? 1 # Get the z right - console.log physicalOriginal, defaultComponents, componentOriginals['physics.Physical'], physicalConfig [ {original: componentOriginals['existence.Exists'], majorVersion: 0, config: {}} {original: componentOriginals['physics.Physical'], majorVersion: 0, config: physicalConfig}