Add GIF recorder background color option

This commit is contained in:
JannisX11 2021-05-17 22:29:55 +02:00
parent ce62851324
commit 7b4ce2635f
6 changed files with 11 additions and 8 deletions

View File

@ -1005,7 +1005,7 @@ class ColorPicker extends Widget {
this.value = new tinycolor('ffffff')
this.jq.spectrum({
preferredFormat: "hex",
color: 'ffffff',
color: data.value || 'ffffff',
showAlpha: true,
showInput: true,
maxSelectionSize: 128,

View File

@ -160,7 +160,8 @@ function buildForm(dialog) {
id: 'cp_'+form_id,
name: tl(data.label),
label: false,
private: true
private: true,
value: data.value
})
}
data.colorpicker.onChange = function() {

View File

@ -1270,7 +1270,6 @@ function openQuadView() {
}
function editCameraPreset(preset, presets) {
console.log('x')
let {name, projection, position, target, zoom} = preset;
let dialog = new Dialog({
@ -1527,8 +1526,8 @@ const Screencam = {
const gif = new GIF({
repeat: options.repeat,
quality: options.quality,
background: {r: 30, g: 0, b: 255},
transparent: 0x1e01ff,
background: options.background ? options.background : {r: 30, g: 0, b: 255},
transparent: options.background ? undefined : 0x1e01ff,
});
if (options.turnspeed) {
@ -2220,15 +2219,18 @@ BARS.defineActions(function() {
length: {label: 'dialog.create_gif.length', type: 'number', value: 10, step: 0.25},
fps: {label: 'dialog.create_gif.fps', type: 'number', value: 10},
quality:{label: 'dialog.create_gif.compression', type: 'number', value: 20, min: 1, max: 80},
color: {label: 'dialog.create_gif.color', type: 'color', value: '#00000000'},
turn: {label: 'dialog.create_gif.turn', type: 'number', value: 0, min: -10, max: 10},
play: {label: 'dialog.create_gif.play', type: 'checkbox', condition: Animator.open},
},
onConfirm: function(formData) {
let background = formData.color.toHex8String() != '#00000000' ? formData.color.toHexString() : undefined;
Screencam.createGif({
length_mode: formData.length_mode,
length: limitNumber(formData.length, 0.1, 24000),
fps: limitNumber(formData.fps, 0.5, 30),
quality: limitNumber(formData.quality, 0, 30),
background,
play: formData.play,
turnspeed: formData.turn,
}, Screencam.returnScreenshot)

View File

@ -363,6 +363,7 @@
"dialog.create_gif.length": "Length",
"dialog.create_gif.fps": "FPS",
"dialog.create_gif.compression": "Compression Amount",
"dialog.create_gif.color": "Background Color",
"dialog.create_gif.turn": "Turntable Speed",
"dialog.create_gif.play": "Start Animation",

File diff suppressed because one or more lines are too long

View File

@ -266,7 +266,7 @@
container.toggleClass("sp-flat", flat);
container.toggleClass("sp-input-disabled", !opts.showInput);
container.toggleClass("sp-alpha-enabled", opts.showAlpha);
container.toggleClass("sp-reset-enabled", opts.defaultColor);
container.toggleClass("sp-reset-enabled", !!opts.defaultColor);
container.toggleClass("sp-clear-enabled", allowEmpty);
container.toggleClass("sp-buttons-disabled", !opts.showButtons);
container.toggleClass("sp-palette-buttons-disabled", !opts.togglePaletteOnly);