fix update of colorpickers

master
JFH 2020-12-27 17:26:34 +01:00
parent d2f48b95d5
commit fc2d630b67
5 changed files with 21 additions and 8 deletions

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="403" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="green" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h80v20h-80zM309 0h94v20h-94z"/><path fill="url(#smooth)" d="M0 0h403v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 47.23%</text><text class="high" x="5" y="14">Statements 47.23%</text><text class="shadow" x="125.5" y="15">Branches 34.77%</text><text class="high" x="125" y="14">Branches 34.77%</text><text class="shadow" x="234.5" y="15">Lines 48.3%</text><text class="high" x="234" y="14">Lines 48.3%</text><text class="shadow" x="314.5" y="15">Functions 53%</text><text class="high" x="314" y="14">Functions 53%</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="green" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 47.22%</text><text class="high" x="5" y="14">Statements 47.22%</text><text class="shadow" x="125.5" y="15">Branches 34.88%</text><text class="high" x="125" y="14">Branches 34.88%</text><text class="shadow" x="234.5" y="15">Lines 48.21%</text><text class="high" x="234" y="14">Lines 48.21%</text><text class="shadow" x="321.5" y="15">Functions 54.19%</text><text class="high" x="321" y="14">Functions 54.19%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#e05d44" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">140/143</text><text class="high" x="46" y="14">140/143</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="#696969" d="M0 0h41v20H0z"/><path fill="#e05d44" d="M41 0h56v20H41z"/><path fill="url(#smooth)" d="M0 0h97v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Tests</text><text class="high" x="5" y="14">Tests</text><text class="shadow" x="46.5" y="15">141/143</text><text class="high" x="46" y="14">141/143</text></g></svg>

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 823 B

View File

@ -17,13 +17,25 @@ class BottomPanelHandlers {
this.editor = editor;
this.svgCanvas = editor.canvas;
}
/**
* @type {module}
*/
get selectedElement () {
return this.editor.selectedElement;
}
/**
* @type {module}
*/
get multiselected () {
return this.editor.multiselected;
}
/**
* @type {module}
*/
changeStrokeWidth (e) {
let val = e.target.value;
if (val === 0 && this.editor.selectedElement && ['line', 'polyline'].includes(this.editor.selectedElement.nodeName)) {
if (val === 0 && this.selectedElement && ['line', 'polyline'].includes(this.selectedElement.nodeName)) {
val = 1;
}
this.svgCanvas.setStrokeWidth(val);

View File

@ -316,7 +316,7 @@ class TopPanelHandlers {
* @returns {void}
*/
clickUndo () {
const {undoMgr} = this.editor;
const {undoMgr} = this.editor.canvas;
if (undoMgr.getUndoStackSize() > 0) {
undoMgr.undo();
this.editor.layersPanel.populateLayers();

View File

@ -849,7 +849,8 @@ editor.init = () => {
$('#group_opacity').val(opacPerc);
$('#opac_slider').slider('option', 'value', opacPerc);
$id('elem_id').value = editor.selectedElement.id;
$id('elem_class').value = (editor.selectedElement.getAttribute('class') !== null) ? editor.selectedElement.getAttribute('class') : '';
$id('elem_class').value =
(editor.selectedElement.getAttribute('class') !== null) ? editor.selectedElement.getAttribute('class') : '';
}
editor.bottomPanelHandlers.updateToolButtonState();
@ -1540,11 +1541,11 @@ editor.init = () => {
* @returns {void}
*/
editor.zoomImage = function (multiplier) {
const resolution = this.svgCanvasgetResolution();
const resolution = svgCanvas.getResolution();
multiplier = multiplier ? resolution.zoom * multiplier : 1;
// setResolution(res.w * multiplier, res.h * multiplier, true);
$id('zoom').value = (multiplier * 100).toFixed(1);
this.svgCanvassetZoom(multiplier);
svgCanvas.setZoom(multiplier);
zoomDone();
updateCanvas(true);
};
@ -1847,7 +1848,7 @@ editor.init = () => {
*/
const saveSourceEditor = (e) => {
const $editorDialog = document.getElementById('se-svg-editor-dialog');
if ($editorDialog.getAttribute('dialog') === 'open') return;
if ($editorDialog.getAttribute('dialog') !== 'open') return;
const saveChanges = () => {
svgCanvas.clearSelection();
hideSourceEditor();