-# キャラクター選択ダイアログを表現するビュー
+# キャラクター設定ダイアログを表現するビュー
 Smalruby.CharacterModalView = Backbone.View.extend
   model: new Smalruby.Character()
 

      drag: (event, ui) ->
        pos = ui.position
        self.model.set
          x: pos.left * zoom
          y: pos.top * zoom

    $('#character-modal-preview').droppable
      drop: (event, ui) ->
        pos = ui.draggable.position()
        self.model.set
          x: pos.left * zoom
          y: pos.top * zoom

    @.$el.find('input[name="character[name]"]').keypress (e) ->
      e = window.event if !e

  onChangeX: (model, value, options) ->
    @.$el.find('input[name="character[x]"]').val(value)
    $('#character_x_value').text(value)
    $('#character-modal-character').css('left', value * @.previewZoomLevel)

  onChangeY: (model, value, options) ->
    @.$el.find('input[name="character[y]"]').val(value)
    $('#character_y_value').text(value)
    $('#character-modal-character').css('top', value * @.previewZoomLevel)

  onChangeAngle: (model, value, options) ->
    @.$el.find('input[name="character[angle]"]').val(value)
