Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop create shim build #1776

Open
wants to merge 5 commits into
base: dev-3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/dd-drop/dd-drop-coverage.js

Large diffs are not rendered by default.

95 changes: 55 additions & 40 deletions build/dd-drop/dd-drop-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ YUI.add('dd-drop', function (Y, NAME) {


//DD init speed up.
// (GS) Causes errors.
// (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html
// (GS) However, changing from async to sync
// (GS) will cause change propagation, so leave it alone
// (GS) until further investigation and thorough testing.
Y.on('domready', Y.bind(function() {
Y.later(100, this, this._createShim);
Y.later(100, this, Drop_createShim);
}, this));
DDM._regTarget(this);

Expand Down Expand Up @@ -178,6 +183,55 @@ YUI.add('dd-drop', function (Y, NAME) {
}
};

function Drop_createShim() {
//No playground, defer
if (!DDM._pg) {
Y.later(10, this, Drop_createShim);
return;
}
if (this.shim) return;

var s = this.get('node');

if (this.get('useShim')) {
createShimNode(this, s);
} else {
this.shim = s;
}
}

function createShimNode(drop, s) {
var s, id;
try {
id = s.get("id");
} catch(ex) {
// _stateProxy is null, TypeError thrown getting
// _stateProxy[id].
// See: http://yuilibrary.com/trac-archive/tickets/2532985.html
return s;
}

s = Y.Node.create('<div id="' + s.get('id') + '_shim"></div>');
s.setStyles({
height: drop.get(NODE).get(OFFSET_HEIGHT) + 'px',
width: drop.get(NODE).get(OFFSET_WIDTH) + 'px',
backgroundColor: 'yellow',
opacity: '.5',
zIndex: '1',
overflow: 'hidden',
top: '-900px',
left: '-900px',
position: 'absolute'
});
DDM._pg.appendChild(s);

s.on('mouseover', Y.bind(drop._handleOverEvent, drop));
s.on('mouseout', Y.bind(drop._handleOutEvent, drop));
drop.shim = s;
drop.fire("shimCreated", {drag: DDM.activeDrag });
return s;
}

Y.extend(Drop, Y.Base, {
/**
* The default bubbleTarget for this object. Default: Y.DD.DDM
Expand Down Expand Up @@ -435,46 +489,7 @@ YUI.add('dd-drop', function (Y, NAME) {
left: xy[0]
};
},
/**
* Creates the Target shim and adds it to the DDM's playground..
* @private
* @method _createShim
*/
_createShim: function() {
//No playground, defer
if (!DDM._pg) {
Y.later(10, this, this._createShim);
return;
}
//Shim already here, cancel
if (this.shim) {
return;
}
var s = this.get('node');

if (this.get('useShim')) {
s = Y.Node.create('<div id="' + this.get(NODE).get('id') + '_shim"></div>');
s.setStyles({
height: this.get(NODE).get(OFFSET_HEIGHT) + 'px',
width: this.get(NODE).get(OFFSET_WIDTH) + 'px',
backgroundColor: 'yellow',
opacity: '.5',
zIndex: '1',
overflow: 'hidden',
top: '-900px',
left: '-900px',
position: 'absolute'
});

DDM._pg.appendChild(s);

s.on('mouseover', Y.bind(this._handleOverEvent, this));
s.on('mouseout', Y.bind(this._handleOutEvent, this));
}


this.shim = s;
},
/**
* This handles the over target call made from this object or from the DDM
* @private
Expand Down
2 changes: 1 addition & 1 deletion build/dd-drop/dd-drop-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 56 additions & 41 deletions build/dd-drop/dd-drop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
YUI.add('dd-drop', function (Y, NAME) {
YUI.add('dd-drop', function (Y, NAME){


/**
Expand Down Expand Up @@ -71,8 +71,13 @@ YUI.add('dd-drop', function (Y, NAME) {


//DD init speed up.
// (GS) Causes errors.
// (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html
// (GS) However, changing from async to sync
// (GS) will cause change propagation, so leave it alone
// (GS) until further investigation and thorough testing.
Y.on('domready', Y.bind(function() {
Y.later(100, this, this._createShim);
Y.later(100, this, Drop_createShim);
}, this));
DDM._regTarget(this);

Expand Down Expand Up @@ -177,6 +182,55 @@ YUI.add('dd-drop', function (Y, NAME) {
}
};

function Drop_createShim() {
//No playground, defer
if (!DDM._pg) {
Y.later(10, this, Drop_createShim);
return;
}
if (this.shim) return;

var s = this.get('node');

if (this.get('useShim')) {
createShimNode(this, s);
} else {
this.shim = s;
}
}

function createShimNode(drop, s) {
var id;
try {
id = s.get("id");
} catch(ex) {
// _stateProxy is null, TypeError thrown getting
// _stateProxy[id].
// See: http://yuilibrary.com/trac-archive/tickets/2532985.html
return s;
}

s = Y.Node.create('<div id="' + s.get('id') + '_shim"></div>');
s.setStyles({
height: drop.get(NODE).get(OFFSET_HEIGHT) + 'px',
width: drop.get(NODE).get(OFFSET_WIDTH) + 'px',
backgroundColor: 'yellow',
opacity: '.5',
zIndex: '1',
overflow: 'hidden',
top: '-900px',
left: '-900px',
position: 'absolute'
});
DDM._pg.appendChild(s);

s.on('mouseover', Y.bind(drop._handleOverEvent, drop));
s.on('mouseout', Y.bind(drop._handleOutEvent, drop));
drop.shim = s;
drop.fire("shimCreated", {drag: DDM.activeDrag });
return s;
}

Y.extend(Drop, Y.Base, {
/**
* The default bubbleTarget for this object. Default: Y.DD.DDM
Expand Down Expand Up @@ -434,46 +488,7 @@ YUI.add('dd-drop', function (Y, NAME) {
left: xy[0]
};
},
/**
* Creates the Target shim and adds it to the DDM's playground..
* @private
* @method _createShim
*/
_createShim: function() {
//No playground, defer
if (!DDM._pg) {
Y.later(10, this, this._createShim);
return;
}
//Shim already here, cancel
if (this.shim) {
return;
}
var s = this.get('node');

if (this.get('useShim')) {
s = Y.Node.create('<div id="' + this.get(NODE).get('id') + '_shim"></div>');
s.setStyles({
height: this.get(NODE).get(OFFSET_HEIGHT) + 'px',
width: this.get(NODE).get(OFFSET_WIDTH) + 'px',
backgroundColor: 'yellow',
opacity: '.5',
zIndex: '1',
overflow: 'hidden',
top: '-900px',
left: '-900px',
position: 'absolute'
});

DDM._pg.appendChild(s);

s.on('mouseover', Y.bind(this._handleOverEvent, this));
s.on('mouseout', Y.bind(this._handleOutEvent, this));
}


this.shim = s;
},
/**
* This handles the over target call made from this object or from the DDM
* @private
Expand Down
6 changes: 6 additions & 0 deletions src/build/dd-constrain/dd-constrain-coverage.js

Large diffs are not rendered by default.

Loading