|
@ -140,6 +140,42 @@ Item.prototype.repositionY = function() { |
|
|
// should be implemented by the item
|
|
|
// should be implemented by the item
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Repaint a drag area on the center of the item when the item is selected |
|
|
|
|
|
* @protected |
|
|
|
|
|
*/ |
|
|
|
|
|
Item.prototype._repaintDragCenter = function () { |
|
|
|
|
|
if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) { |
|
|
|
|
|
var me = this; |
|
|
|
|
|
|
|
|
|
|
|
// create and show drag area
|
|
|
|
|
|
var dragCenter = document.createElement('div'); |
|
|
|
|
|
dragCenter.className = 'vis-drag-center'; |
|
|
|
|
|
dragCenter.dragCenterItem = this; |
|
|
|
|
|
|
|
|
|
|
|
new Hammer(dragCenter).on('doubletap', function (event) { |
|
|
|
|
|
event.stopPropagation(); |
|
|
|
|
|
me.parent.itemSet._onUpdateItem(me); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (this.dom.box) { |
|
|
|
|
|
this.dom.box.appendChild(dragCenter); |
|
|
|
|
|
} |
|
|
|
|
|
else if (this.dom.point) { |
|
|
|
|
|
this.dom.point.appendChild(dragCenter); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.dom.dragCenter = dragCenter; |
|
|
|
|
|
} |
|
|
|
|
|
else if (!this.selected && this.dom.dragCenter) { |
|
|
|
|
|
// delete drag area
|
|
|
|
|
|
if (this.dom.dragCenter.parentNode) { |
|
|
|
|
|
this.dom.dragCenter.parentNode.removeChild(this.dom.dragCenter); |
|
|
|
|
|
} |
|
|
|
|
|
this.dom.dragCenter = null; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Repaint a delete button on the top right of the item when the item is selected |
|
|
* Repaint a delete button on the top right of the item when the item is selected |
|
|
* @param {HTMLElement} anchor |
|
|
* @param {HTMLElement} anchor |
|
@ -401,33 +437,4 @@ Item.prototype.getWidthRight = function () { |
|
|
return 0; |
|
|
return 0; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Repaint a drag area on the center of the item when the item is selected |
|
|
|
|
|
* @protected |
|
|
|
|
|
*/ |
|
|
|
|
|
Item.prototype._repaintDragCenter = function () { |
|
|
|
|
|
if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) { |
|
|
|
|
|
// create and show drag area
|
|
|
|
|
|
var dragCenter = document.createElement('div'); |
|
|
|
|
|
dragCenter.className = 'vis-drag-center'; |
|
|
|
|
|
dragCenter.dragCenterItem = this; |
|
|
|
|
|
|
|
|
|
|
|
if (this.dom.box) { |
|
|
|
|
|
this.dom.box.appendChild(dragCenter); |
|
|
|
|
|
} |
|
|
|
|
|
else if (this.dom.point) { |
|
|
|
|
|
this.dom.point.appendChild(dragCenter); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.dom.dragCenter = dragCenter; |
|
|
|
|
|
} |
|
|
|
|
|
else if (!this.selected && this.dom.dragCenter) { |
|
|
|
|
|
// delete drag area
|
|
|
|
|
|
if (this.dom.dragCenter.parentNode) { |
|
|
|
|
|
this.dom.dragCenter.parentNode.removeChild(this.dom.dragCenter); |
|
|
|
|
|
} |
|
|
|
|
|
this.dom.dragCenter = null; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
module.exports = Item; |
|
|
module.exports = Item; |