Catch UI edge cases in gui.grid.swatch
This commit is contained in:
parent
3006e2e706
commit
9da1ea6dbb
|
@ -2819,8 +2819,8 @@ gui.info = function (title, message) {
|
||||||
var config = {
|
var config = {
|
||||||
type : 'info',
|
type : 'info',
|
||||||
buttons : ['Ok'],
|
buttons : ['Ok'],
|
||||||
title: 'Sometitle',
|
title: title,
|
||||||
message : 'some message'
|
message : message
|
||||||
};
|
};
|
||||||
dialog.showMessageBox(config);
|
dialog.showMessageBox(config);
|
||||||
/*
|
/*
|
||||||
|
@ -2836,6 +2836,16 @@ gui.info = function (title, message) {
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
gui.confirm = function () {};
|
gui.confirm = function () {};
|
||||||
|
gui.warn = function (title, message) {
|
||||||
|
'use strict';
|
||||||
|
var config = {
|
||||||
|
type : 'warning',
|
||||||
|
buttons : ['Ok'],
|
||||||
|
title: title,
|
||||||
|
message : message
|
||||||
|
};
|
||||||
|
dialog.showMessageBox(config);
|
||||||
|
};
|
||||||
gui.error = function () {};
|
gui.error = function () {};
|
||||||
|
|
||||||
/******
|
/******
|
||||||
|
@ -2959,10 +2969,9 @@ gui.grid.blackout = function (t) {
|
||||||
gui.grid.setLight(i, [0, 0, 0]);
|
gui.grid.setLight(i, [0, 0, 0]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gui.grid.changeAll = function () {
|
gui.grid.changeAll = function (rgb) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var rgb = $('.w2ui-msg-body .default').attr('color').split(','),
|
var i;
|
||||||
i;
|
|
||||||
for (i = 0; i < mcopy.state.sequence.arr.length; i++) {
|
for (i = 0; i < mcopy.state.sequence.arr.length; i++) {
|
||||||
if (mcopy.state.sequence.arr[i] === 'CF'
|
if (mcopy.state.sequence.arr[i] === 'CF'
|
||||||
|| mcopy.state.sequence.arr[i] === 'CB') {
|
|| mcopy.state.sequence.arr[i] === 'CB') {
|
||||||
|
@ -2978,8 +2987,6 @@ gui.grid.swatches = function (x) {
|
||||||
body : $('#light-swatches').html(),
|
body : $('#light-swatches').html(),
|
||||||
buttons : '<button id="sequencer-ok" class="btn btn-default">Ok</button> <button id="sequencer-changeall" class="btn btn-warning">Change All</button> <button id="sequencer-cancel" class="btn btn-default">Cancel</button>',
|
buttons : '<button id="sequencer-ok" class="btn btn-default">Ok</button> <button id="sequencer-changeall" class="btn btn-warning">Change All</button> <button id="sequencer-cancel" class="btn btn-default">Cancel</button>',
|
||||||
onClose : function () {
|
onClose : function () {
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.w2ui-msg-body .swatch').removeClass('default set');
|
$('.w2ui-msg-body .swatch').removeClass('default set');
|
||||||
|
@ -2989,17 +2996,28 @@ gui.grid.swatches = function (x) {
|
||||||
gui.grid.swatchesElem.close();
|
gui.grid.swatchesElem.close();
|
||||||
});
|
});
|
||||||
$('#sequencer-changeall').on('click', function () {
|
$('#sequencer-changeall').on('click', function () {
|
||||||
var doit = confirm('You sure you want to change all light settings?');
|
var doit = confirm('You sure you want to change all light settings?'),
|
||||||
if (doit) {
|
elem = $('.w2ui-msg-body .default'),
|
||||||
gui.grid.changeAll();
|
rgb;
|
||||||
|
if (doit && elem.length > 0) {
|
||||||
|
rgb = elem.attr('color').split(',');
|
||||||
|
gui.grid.changeAll(rgb);
|
||||||
gui.grid.swatchesElem.close();
|
gui.grid.swatchesElem.close();
|
||||||
|
} else if (doit && elem.length === 0) {
|
||||||
|
gui.warn('Select Color', 'Please select a color to proceed.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#sequencer-ok').on('click', function () {
|
$('#sequencer-ok').on('click', function () {
|
||||||
var rgb = $('.w2ui-msg-body .default').attr('color').split(',');
|
var elem = $('.w2ui-msg-body .default'),
|
||||||
gui.grid.setLight(x, rgb);
|
rgb;
|
||||||
light.color = rgb;
|
if (elem.length > 0) {
|
||||||
gui.grid.swatchesElem.close();
|
rgb = elem.attr('color').split(',');
|
||||||
|
gui.grid.setLight(x, rgb);
|
||||||
|
light.color = rgb;
|
||||||
|
gui.grid.swatchesElem.close();
|
||||||
|
} else {
|
||||||
|
gui.warn('Select Color', 'Please select a color to proceed.');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
gui.grid.scrollTo = function (i) {
|
gui.grid.scrollTo = function (i) {
|
||||||
|
|
|
@ -363,8 +363,8 @@ gui.info = function (title, message) {
|
||||||
var config = {
|
var config = {
|
||||||
type : 'info',
|
type : 'info',
|
||||||
buttons : ['Ok'],
|
buttons : ['Ok'],
|
||||||
title: 'Sometitle',
|
title: title,
|
||||||
message : 'some message'
|
message : message
|
||||||
};
|
};
|
||||||
dialog.showMessageBox(config);
|
dialog.showMessageBox(config);
|
||||||
/*
|
/*
|
||||||
|
@ -380,6 +380,16 @@ gui.info = function (title, message) {
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
gui.confirm = function () {};
|
gui.confirm = function () {};
|
||||||
|
gui.warn = function (title, message) {
|
||||||
|
'use strict';
|
||||||
|
var config = {
|
||||||
|
type : 'warning',
|
||||||
|
buttons : ['Ok'],
|
||||||
|
title: title,
|
||||||
|
message : message
|
||||||
|
};
|
||||||
|
dialog.showMessageBox(config);
|
||||||
|
};
|
||||||
gui.error = function () {};
|
gui.error = function () {};
|
||||||
|
|
||||||
/******
|
/******
|
||||||
|
@ -503,10 +513,9 @@ gui.grid.blackout = function (t) {
|
||||||
gui.grid.setLight(i, [0, 0, 0]);
|
gui.grid.setLight(i, [0, 0, 0]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gui.grid.changeAll = function () {
|
gui.grid.changeAll = function (rgb) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var rgb = $('.w2ui-msg-body .default').attr('color').split(','),
|
var i;
|
||||||
i;
|
|
||||||
for (i = 0; i < mcopy.state.sequence.arr.length; i++) {
|
for (i = 0; i < mcopy.state.sequence.arr.length; i++) {
|
||||||
if (mcopy.state.sequence.arr[i] === 'CF'
|
if (mcopy.state.sequence.arr[i] === 'CF'
|
||||||
|| mcopy.state.sequence.arr[i] === 'CB') {
|
|| mcopy.state.sequence.arr[i] === 'CB') {
|
||||||
|
@ -522,8 +531,6 @@ gui.grid.swatches = function (x) {
|
||||||
body : $('#light-swatches').html(),
|
body : $('#light-swatches').html(),
|
||||||
buttons : '<button id="sequencer-ok" class="btn btn-default">Ok</button> <button id="sequencer-changeall" class="btn btn-warning">Change All</button> <button id="sequencer-cancel" class="btn btn-default">Cancel</button>',
|
buttons : '<button id="sequencer-ok" class="btn btn-default">Ok</button> <button id="sequencer-changeall" class="btn btn-warning">Change All</button> <button id="sequencer-cancel" class="btn btn-default">Cancel</button>',
|
||||||
onClose : function () {
|
onClose : function () {
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.w2ui-msg-body .swatch').removeClass('default set');
|
$('.w2ui-msg-body .swatch').removeClass('default set');
|
||||||
|
@ -533,17 +540,28 @@ gui.grid.swatches = function (x) {
|
||||||
gui.grid.swatchesElem.close();
|
gui.grid.swatchesElem.close();
|
||||||
});
|
});
|
||||||
$('#sequencer-changeall').on('click', function () {
|
$('#sequencer-changeall').on('click', function () {
|
||||||
var doit = confirm('You sure you want to change all light settings?');
|
var doit = confirm('You sure you want to change all light settings?'),
|
||||||
if (doit) {
|
elem = $('.w2ui-msg-body .default'),
|
||||||
gui.grid.changeAll();
|
rgb;
|
||||||
|
if (doit && elem.length > 0) {
|
||||||
|
rgb = elem.attr('color').split(',');
|
||||||
|
gui.grid.changeAll(rgb);
|
||||||
gui.grid.swatchesElem.close();
|
gui.grid.swatchesElem.close();
|
||||||
|
} else if (doit && elem.length === 0) {
|
||||||
|
gui.warn('Select Color', 'Please select a color to proceed.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#sequencer-ok').on('click', function () {
|
$('#sequencer-ok').on('click', function () {
|
||||||
var rgb = $('.w2ui-msg-body .default').attr('color').split(',');
|
var elem = $('.w2ui-msg-body .default'),
|
||||||
gui.grid.setLight(x, rgb);
|
rgb;
|
||||||
light.color = rgb;
|
if (elem.length > 0) {
|
||||||
gui.grid.swatchesElem.close();
|
rgb = elem.attr('color').split(',');
|
||||||
|
gui.grid.setLight(x, rgb);
|
||||||
|
light.color = rgb;
|
||||||
|
gui.grid.swatchesElem.close();
|
||||||
|
} else {
|
||||||
|
gui.warn('Select Color', 'Please select a color to proceed.');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
gui.grid.scrollTo = function (i) {
|
gui.grid.scrollTo = function (i) {
|
||||||
|
|
Loading…
Reference in New Issue