提交 99f14143 编写于 作者: G gusreiber

fixing drag bug

上级 ffe49d0b
...@@ -7,6 +7,9 @@ $(function() { ...@@ -7,6 +7,9 @@ $(function() {
// We need to use Behaviour.js to wait until after radioBlock.js Behaviour.js rules // We need to use Behaviour.js to wait until after radioBlock.js Behaviour.js rules
// have been applied, otherwise row-set rows become visible across sections. // have been applied, otherwise row-set rows become visible across sections.
var done = false; var done = false;
Behaviour.specify(".dd-handle", 'config-drag-start',1000,fixDragEvent);
Behaviour.specify(".block-control", 'row-set-block-control', 1000, function() { // jshint ignore:line Behaviour.specify(".block-control", 'row-set-block-control', 1000, function() { // jshint ignore:line
if (done) { if (done) {
return; return;
...@@ -18,7 +21,9 @@ $(function() { ...@@ -18,7 +21,9 @@ $(function() {
if (configTables.size() > 0) { if (configTables.size() > 0) {
var tabBarShowPreferenceKey = 'config:usetabs'; var tabBarShowPreferenceKey = 'config:usetabs';
var tabBarShowPreference = jenkinsLocalStorage.getGlobalItem(tabBarShowPreferenceKey, "yes"); var tabBarShowPreference = jenkinsLocalStorage.getGlobalItem(tabBarShowPreferenceKey, "yes");
fixDragEvent(configTables);
var tabBarWidget = require('./widgets/config/tabbar.js'); var tabBarWidget = require('./widgets/config/tabbar.js');
if (tabBarShowPreference === "yes") { if (tabBarShowPreference === "yes") {
configTables.each(function() { configTables.each(function() {
...@@ -94,3 +99,25 @@ function addFinderToggle(configTableMetadata) { ...@@ -94,3 +99,25 @@ function addFinderToggle(configTableMetadata) {
function fireBottomStickerAdjustEvent() { function fireBottomStickerAdjustEvent() {
Event.fire(window, 'jenkins:bottom-sticker-adjust'); // jshint ignore:line Event.fire(window, 'jenkins:bottom-sticker-adjust'); // jshint ignore:line
} }
// YUI Drag widget does not like to work on elements with a relative position.
// This tells the element to switch to static position at the start of the drag, so it can work.
function fixDragEvent(handle){
var isReady = false;
var $handle = $(handle);
var $chunk = $handle.closest('.repeated-chunk');
$handle
.mousedown(function(){
isReady = true;
})
.mousemove(function(){
if(isReady && !$chunk.hasClass('dragging')){
$chunk.addClass('dragging');
console.log('.....drag.....');
}
})
.mouseup(function(){
isReady = false;
console.log('stop');
$chunk.removeClass('dragging');
});
}
...@@ -67,7 +67,6 @@ exports.addTabs = function(configTable) { ...@@ -67,7 +67,6 @@ exports.addTabs = function(configTable) {
}; };
exports.addTabsActivator = function(configTable) { exports.addTabsActivator = function(configTable) {
var $ = jQD.getJQuery(); var $ = jQD.getJQuery();
var configWidgets = $('<div class="jenkins-config-widgets"><div class="showTabs" title="Add configuration section tabs">Add tabs</div></div>'); var configWidgets = $('<div class="jenkins-config-widgets"><div class="showTabs" title="Add configuration section tabs">Add tabs</div></div>');
configWidgets.insertBefore(configTable.parent()); configWidgets.insertBefore(configTable.parent());
......
...@@ -234,7 +234,11 @@ ...@@ -234,7 +234,11 @@
border-color:@line-blue; border-color:@line-blue;
box-shadow:0 2px 10px @shade, inset 0 200px 200px -200px @birghtest; box-shadow:0 2px 10px @shade, inset 0 200px 200px -200px @birghtest;
position:relative; position:relative;
z-index:2} z-index:2
}
.repeated-chunk.dragging{
position:static;
}
.repeated-chunk{ .repeated-chunk{
border:1px solid @shade; border:1px solid @shade;
margin:2px; margin:2px;
...@@ -285,4 +289,9 @@ ...@@ -285,4 +289,9 @@
} }
} }
} }
#ygddfdiv {
background:@light-backgrond;
border:1px solid @line-blue !important;
opacity:.5;
}
.yui-skin-sam .yuimenu {z-index:9999 !important} .yui-skin-sam .yuimenu {z-index:9999 !important}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册