Skip to content

Commit

Permalink
бабл для драга определяем на этапе клика мышки
Browse files Browse the repository at this point in the history
  • Loading branch information
Katochimoto committed Nov 29, 2016
1 parent 52fe96f commit 473c61c
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 38 deletions.
18 changes: 8 additions & 10 deletions dist/x-bubbles-compact.js
Original file line number Diff line number Diff line change
Expand Up @@ -2115,11 +2115,12 @@ var XBubbles =
nodeSet.focus();

var drag = nodeSet.__drag__ = {
onMouseup: onMouseup.bind(this, nodeSet),
onMousemove: utils.throttle(onMousemove.bind(this, nodeSet)),
onScroll: utils.throttle(onScroll.bind(this, nodeSet)),
nodeBubble: nodeBubble,
nodeOffsetX: event.offsetX,
nodeOffsetY: event.offsetY,
onMousemove: utils.throttle(onMousemove.bind(this, nodeSet)),
onMouseup: onMouseup.bind(this, nodeSet),
onScroll: utils.throttle(onScroll.bind(this, nodeSet)),
x: 0,
y: 0
};
Expand Down Expand Up @@ -2181,7 +2182,7 @@ var XBubbles =
}
}

function onMousemove(dragSet, event) {
function onMousemove(dragSet) {
var drag = dragSet.__drag__;
if (!drag) {
return;
Expand All @@ -2193,15 +2194,12 @@ var XBubbles =

currentDragSet = dragSet;
currentDragSet.classList.add(CLS.DRAGSTART);
select.add(drag.nodeBubble);

var nodeBubble = bubbleset.closestNodeBubble(event.target);
var moveElement = void 0;

if (nodeBubble) {
select.add(nodeBubble);
if (select.get(currentDragSet).length === 1) {
moveElement = nodeBubble.cloneNode(true);
}
if (select.get(currentDragSet).length === 1) {
moveElement = drag.nodeBubble.cloneNode(true);
}

if (!moveElement) {
Expand Down
2 changes: 1 addition & 1 deletion dist/x-bubbles-compact.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/x-bubbles-compact.min.js.map

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions dist/x-bubbles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2115,11 +2115,12 @@ var XBubbles =
nodeSet.focus();

var drag = nodeSet.__drag__ = {
onMouseup: onMouseup.bind(this, nodeSet),
onMousemove: utils.throttle(onMousemove.bind(this, nodeSet)),
onScroll: utils.throttle(onScroll.bind(this, nodeSet)),
nodeBubble: nodeBubble,
nodeOffsetX: event.offsetX,
nodeOffsetY: event.offsetY,
onMousemove: utils.throttle(onMousemove.bind(this, nodeSet)),
onMouseup: onMouseup.bind(this, nodeSet),
onScroll: utils.throttle(onScroll.bind(this, nodeSet)),
x: 0,
y: 0
};
Expand Down Expand Up @@ -2181,7 +2182,7 @@ var XBubbles =
}
}

function onMousemove(dragSet, event) {
function onMousemove(dragSet) {
var drag = dragSet.__drag__;
if (!drag) {
return;
Expand All @@ -2193,15 +2194,12 @@ var XBubbles =

currentDragSet = dragSet;
currentDragSet.classList.add(CLS.DRAGSTART);
select.add(drag.nodeBubble);

var nodeBubble = bubbleset.closestNodeBubble(event.target);
var moveElement = void 0;

if (nodeBubble) {
select.add(nodeBubble);
if (select.get(currentDragSet).length === 1) {
moveElement = nodeBubble.cloneNode(true);
}
if (select.get(currentDragSet).length === 1) {
moveElement = drag.nodeBubble.cloneNode(true);
}

if (!moveElement) {
Expand Down
2 changes: 1 addition & 1 deletion dist/x-bubbles.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/x-bubbles.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/x-bubbles.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/x-bubbles.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "x-bubbles",
"description": "Bubbles",
"version": "0.0.26",
"version": "0.0.27",
"keywords": [],
"homepage": "https://github.com/Katochimoto/x-bubbles",
"author": {
Expand Down
20 changes: 9 additions & 11 deletions src/core/drag/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ function onMousedown(event) {
nodeSet.focus();

const drag = nodeSet.__drag__ = {
onMouseup: onMouseup.bind(this, nodeSet),
onMousemove: utils.throttle(onMousemove.bind(this, nodeSet)),
onScroll: utils.throttle(onScroll.bind(this, nodeSet)),
nodeBubble: nodeBubble,
nodeOffsetX: event.offsetX,
nodeOffsetY: event.offsetY,
onMousemove: utils.throttle(onMousemove.bind(this, nodeSet)),
onMouseup: onMouseup.bind(this, nodeSet),
onScroll: utils.throttle(onScroll.bind(this, nodeSet)),
x: 0,
y: 0
y: 0,
};

currentDragSet = null;
Expand Down Expand Up @@ -96,7 +97,7 @@ function onMouseup(dragSet, event) {
}
}

function onMousemove(dragSet, event) {
function onMousemove(dragSet) {
const drag = dragSet.__drag__;
if (!drag) {
return;
Expand All @@ -108,15 +109,12 @@ function onMousemove(dragSet, event) {

currentDragSet = dragSet;
currentDragSet.classList.add(CLS.DRAGSTART);
select.add(drag.nodeBubble);

const nodeBubble = bubbleset.closestNodeBubble(event.target);
let moveElement;

if (nodeBubble) {
select.add(nodeBubble);
if (select.get(currentDragSet).length === 1) {
moveElement = nodeBubble.cloneNode(true);
}
if (select.get(currentDragSet).length === 1) {
moveElement = drag.nodeBubble.cloneNode(true);
}

if (!moveElement) {
Expand Down

0 comments on commit 473c61c

Please sign in to comment.