Fix resizing and dragging issues

This commit is contained in:
James Allen 2014-06-27 15:55:08 +01:00
parent b07def6901
commit 562f28f412
5 changed files with 16 additions and 1 deletions

View file

@ -119,6 +119,7 @@ script(type='text/ng-template', id='entityListItemTemplate')
ng-dblclick="startRenaming()" ng-dblclick="startRenaming()"
draggable draggable
droppable droppable
accept=".entity-name"
on-drop-callback="onDrop" on-drop-callback="onDrop"
) )
div( div(
@ -232,6 +233,7 @@ script(type='text/ng-template', id='entityListItemTemplate')
ng-if="entity.type == 'folder'" ng-if="entity.type == 'folder'"
ng-show="expanded" ng-show="expanded"
droppable droppable
accept=".entity-name"
on-drop-callback="onDrop" on-drop-callback="onDrop"
) )
file-entity( file-entity(

View file

@ -10,7 +10,7 @@ define [
spacing_open: 24 spacing_open: 24
spacing_closed: 24 spacing_closed: 24
onresize: () => onresize: () =>
scope.$broadcast "layout:#{name}:resize" scope.$broadcast "layout:resize"
# Restore previously recorded state # Restore previously recorded state
if (state = $.localStorage("layout.main"))? if (state = $.localStorage("layout.main"))?

View file

@ -58,6 +58,14 @@ define [
editor.commands.removeCommand "showSettingsMenu" editor.commands.removeCommand "showSettingsMenu"
editor.commands.removeCommand "foldall" editor.commands.removeCommand "foldall"
scope.$on "layout:resize", () ->
console.log "LAYOUT RESIZED"
editor.resize()
$(window).on "resize", () ->
console.log "WINDOW RESIZED"
editor.resize()
editor.on "changeSelection", () -> editor.on "changeSelection", () ->
cursor = editor.getCursorPosition() cursor = editor.getCursorPosition()
scope.$apply () -> scope.$apply () ->
@ -91,6 +99,9 @@ define [
scope.$watch "text", (text) -> scope.$watch "text", (text) ->
if text? if text?
editor.setValue(text, -1) editor.setValue(text, -1)
session = editor.getSession()
session.setUseWrapMode(true)
session.setMode(new LatexMode())
scope.$watch "readOnly", (value) -> scope.$watch "readOnly", (value) ->
editor.setReadOnly !!value editor.setReadOnly !!value

View file

@ -10,6 +10,7 @@ define [
$scope.onDrop = (events, ui) -> $scope.onDrop = (events, ui) ->
source = $(ui.draggable).scope().entity source = $(ui.draggable).scope().entity
return if !source?
ide.fileTreeManager.moveEntity(source, $scope.entity) ide.fileTreeManager.moveEntity(source, $scope.entity)
$scope.orderByFoldersFirst = (entity) -> $scope.orderByFoldersFirst = (entity) ->

View file

@ -10,5 +10,6 @@ define [
element.droppable element.droppable
greedy: true greedy: true
hoverClass: "droppable-hover" hoverClass: "droppable-hover"
accept: attrs.accept
drop: scope.onDropCallback drop: scope.onDropCallback
} }