Browse Source

Fix sorter for layers in style manager

pull/79/merge
Artur Arseniev 10 years ago
parent
commit
2d98628524
  1. 1
      src/style_manager/view/LayersView.js
  2. 6
      src/utils/Sorter.js

1
src/style_manager/view/LayersView.js

@ -26,6 +26,7 @@ define(['backbone','./LayerView'],
pfx: this.config.pStylePrefix, pfx: this.config.pStylePrefix,
}) : ''; }) : '';
this.$el.data('model', {});
this.$el.data('collection', this.collection); this.$el.data('collection', this.collection);
}, },

6
src/utils/Sorter.js

@ -629,7 +629,7 @@ define(function(require) {
var model = $(src).data('model'); var model = $(src).data('model');
var $dst = $(dst); var $dst = $(dst);
var targetModel; var targetModel;
console.log($dst, $dst.data('collection'));
while ($dst.length && !targetModel) { while ($dst.length && !targetModel) {
targetModel = $dst.data('model'); targetModel = $dst.data('model');
dst = $dst.get(0); dst = $dst.get(0);
@ -642,7 +642,7 @@ define(function(require) {
} }
var targetCollection = $dst.data('collection'); var targetCollection = $dst.data('collection');
console.log(targetCollection, $dst);
// Check if the elemenet is DRAGGABLE to the target // Check if the elemenet is DRAGGABLE to the target
var drag = model && model.get('draggable'); var drag = model && model.get('draggable');
var draggable = typeof drag !== 'undefined' ? drag : 1; var draggable = typeof drag !== 'undefined' ? drag : 1;
@ -669,7 +669,7 @@ define(function(require) {
// Check if the target could accept the element to be DROPPED inside // Check if the target could accept the element to be DROPPED inside
var accepted = 1; var accepted = 1;
var droppable = targetModel ? targetModel.get('droppable') : 1; var droppable = targetModel && targetModel.get ? targetModel.get('droppable') : 1;
var toDrop = draggable; var toDrop = draggable;
if(droppable instanceof Array) { if(droppable instanceof Array) {
// When I drag blocks src is the HTMLElement of the block // When I drag blocks src is the HTMLElement of the block

Loading…
Cancel
Save