mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-04 17:19:47 -04:00
Fixed WorldSelectModal scale; added an easy way to restrict flexible regions to a fixed ratio.
This commit is contained in:
parent
9acb3670c1
commit
89aa930803
4 changed files with 11 additions and 7 deletions
app
lib/surface
templates/editor/level/modal
views/editor/level/modals
|
@ -22,7 +22,7 @@ module.exports = class RegionChooser extends CocoClass
|
|||
onMouseMove: (e) =>
|
||||
return unless @firstPoint
|
||||
@secondPoint = @options.camera.screenToWorld {x: e.stageX, y: e.stageY}
|
||||
@restrictRegion() if @options.restrictRatio
|
||||
@restrictRegion() if @options.restrictRatio or key.alt
|
||||
@updateShape()
|
||||
|
||||
onMouseUp: (e) =>
|
||||
|
|
|
@ -488,7 +488,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
#- Canvas callbacks
|
||||
|
||||
onResize: (e) =>
|
||||
return if @destroyed
|
||||
return if @destroyed or @options.choosing
|
||||
oldWidth = parseInt @canvas.attr('width'), 10
|
||||
oldHeight = parseInt @canvas.attr('height'), 10
|
||||
aspectRatio = oldWidth / oldHeight
|
||||
|
|
|
@ -24,9 +24,14 @@ block modal-body-content
|
|||
div.alert.alert-info
|
||||
strong Shift-drag
|
||||
| to select
|
||||
div.alert.alert-info
|
||||
strong Enter
|
||||
| to confirm
|
||||
if flexibleRegion
|
||||
div.alert.alert-info
|
||||
strong Alt-shift-drag
|
||||
| to select ratio
|
||||
else
|
||||
div.alert.alert-info
|
||||
strong Enter
|
||||
| to confirm
|
||||
canvas(width=924, height=589)
|
||||
|
||||
block modal-footer-content
|
||||
|
|
|
@ -31,11 +31,11 @@ module.exports = class WorldSelectModal extends ModalView
|
|||
getRenderData: (c={}) =>
|
||||
c = super(c)
|
||||
c.selectingPoint = @dataType is 'point'
|
||||
c.flexibleRegion = @dataType is 'region'
|
||||
c
|
||||
|
||||
afterInsert: ->
|
||||
super()
|
||||
window.e = @$el
|
||||
@initSurface()
|
||||
|
||||
# surface setup
|
||||
|
@ -54,7 +54,6 @@ module.exports = class WorldSelectModal extends ModalView
|
|||
thangTypes: @supermodel.getModels(ThangType)
|
||||
showInvisible: true
|
||||
}
|
||||
window.s = @surface
|
||||
@surface.playing = false
|
||||
@surface.setWorld @world
|
||||
@surface.camera.zoomTo({x: 262, y: -164}, 1.66, 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue