exclusively handle selectability of text via .OxSelectable and body.OxDragging (to be set/unset in dragstart/dragend handlers)

This commit is contained in:
rlx 2013-07-19 08:42:25 +00:00
commit 564ce69a78
17 changed files with 53 additions and 39 deletions

View file

@ -424,6 +424,7 @@ Ox.List = function(options, self) {
|| $parent.is('.OxTarget') // table lists
|| $parent.parent().is('.OxTarget') // table lists with div inside cell
) && !$target.is('.OxSpecialTarget')) {
Ox.$body.addClass('OxDragging');
self.drag = {
ids: self.options.selected
};
@ -466,6 +467,7 @@ Ox.List = function(options, self) {
function dragend(data) {
if (self.drag) {
Ox.$body.removeClass('OxDragging');
that.triggerEvent('draganddropend', {
event: data,
ids: self.drag.ids
@ -933,6 +935,7 @@ Ox.List = function(options, self) {
}
function movestart(data) {
Ox.$body.addClass('OxDragging');
var pos = findItemPosition(data),
$items = self.$items.filter(function($item, i) {
if ($item.is('.OxSelected')) {
@ -973,6 +976,7 @@ Ox.List = function(options, self) {
function moveend(data) {
var ids = [];
Ox.$body.removeClass('OxDragging');
self.$items.forEach(function($item) {
$item.removeClass('OxDrag');
ids.push($item.options('data')[self.options.unique]);

View file

@ -568,6 +568,7 @@ Ox.TableList = function(options, self) {
}
function dragstartColumn(id, e) {
Ox.$body.addClass('OxDragging');
self.drag = {
columnOffsets: getColumnOffsets(),
listOffset: that.$element.offset().left - that.$body.scrollLeft(),
@ -631,6 +632,7 @@ Ox.TableList = function(options, self) {
function dragendColumn(id, e) {
var column = self.visibleColumns.splice(self.drag.stopPos, 1)[0],
width = self.columnWidths.splice(self.drag.stopPos, 1)[0];
Ox.$body.removeClass('OxDragging');
self.visibleColumns.splice(self.drag.stopPos, 0, column);
self.columnWidths.splice(self.drag.stopPos, 0, width);
that.$head.$content.empty();
@ -645,6 +647,7 @@ Ox.TableList = function(options, self) {
function dragstartResize(id, e) {
var pos = getColumnPositionById(id);
Ox.$body.addClass('OxDragging');
self.drag = {
startWidth: self.columnWidths[pos]
};
@ -662,6 +665,7 @@ Ox.TableList = function(options, self) {
function dragendResize(id, e) {
var pos = getColumnPositionById(id);
// fixme: shouldn't this be resizecolumn?
Ox.$body.removeClass('OxDragging');
that.triggerEvent('columnresize', {
id: id,
width: self.columnWidths[pos]

View file

@ -111,7 +111,7 @@ Ox.TreeList = function(options, self) {
$cell.appendTo($item);
$icon && $icon.addClass(data.items ? 'OxToggle' : 'OxTarget').appendTo($cell);
$('<div>')
.addClass('OxCell OxTarget' + (!data.items ? ' OxSelectable' : ''))
.addClass('OxCell OxTarget')
.css({
width: self.options.width - padding - 32 - Ox.UI.SCROLLBAR_SIZE + 'px'
})