fix(blur)

master
JFH 2020-12-11 00:08:58 +01:00
parent 001ec4e3cf
commit bdb51c478c
3 changed files with 22 additions and 64 deletions

View File

@ -123,18 +123,8 @@
</div> </div>
<se-spin-input size="3" id="angle" min=-180 max=180 step=5 src="./images/angle.svg" <se-spin-input size="3" id="angle" min=-180 max=180 step=5 src="./images/angle.svg"
title="Change rotation angle"></se-spin-input> title="Change rotation angle"></se-spin-input>
<div class="toolset" id="tool_blur" title="Change gaussian blur value"> <se-spin-input size="2" id="blur" min=0 max=100 step=5 src="./images/blur.svg"
<se-spin-input size="2" id="blur" min=0 max=10 step=0.1 src="./images/blur.svg" title="Change gaussian blur value"></se-spin-input>
title="Change gaussian blur value"></se-spin-input>
<div id="blur_dropdown" class="dropdown">
<button></button>
<ul>
<li class="special">
<div id="blur_slider"></div>
</li>
</ul>
</div>
</div>
<div class="dropdown toolset" id="tool_position" title="Align Element to Page"> <div class="dropdown toolset" id="tool_position" title="Align Element to Page">
<div id="cur_position" class="icon_label"></div> <div id="cur_position" class="icon_label"></div>
<button></button> <button></button>

View File

@ -705,14 +705,19 @@ input[type=text] {
#tools_bottom { #tools_bottom {
position: absolute; position: absolute;
bottom: 0;
left: 40px; left: 40px;
right: 20px; right: 0;
display: flex; bottom: 0;
flex-flow: row nowrap; height: 40px;
overflow-x: auto; overflow: visible;
align-items: center; }
justify-content: space-between;
#tools_bottom * {
float: left;
}
#palette {
float: right;
} }
.dropdown li.tool_button { .dropdown li.tool_button {

View File

@ -1726,9 +1726,8 @@ editor.init = () => {
const angle = svgCanvas.getRotationAngle(elem); const angle = svgCanvas.getRotationAngle(elem);
$('#angle').val(angle); $('#angle').val(angle);
const blurval = svgCanvas.getBlur(elem); const blurval = svgCanvas.getBlur(elem) * 10;
$('#blur').val(blurval); $id('blur').value = blurval;
$('#blur_slider').slider('option', 'value', blurval);
if (svgCanvas.addedNew) { if (svgCanvas.addedNew) {
if (elname === 'image' && svgCanvas.getMode() === 'image') { if (elname === 'image' && svgCanvas.getMode() === 'image') {
@ -2646,9 +2645,6 @@ editor.init = () => {
return new $.jGraduate.Paint(opts); return new $.jGraduate.Paint(opts);
}; };
// $('#text').focus(function () { textBeingEntered = true; });
// $('#text').blur(function () { textBeingEntered = false; });
// bind the selected event to our function that handles updates to the UI // bind the selected event to our function that handles updates to the UI
svgCanvas.bind('selected', selectedChanged); svgCanvas.bind('selected', selectedChanged);
svgCanvas.bind('transition', elementTransition); svgCanvas.bind('transition', elementTransition);
@ -2730,7 +2726,7 @@ editor.init = () => {
/** /**
* @type {module} * @type {module}
*/ */
const changeRotationAngle = function (e) { const changeRotationAngle = (e) => {
svgCanvas.setRotationAngle(e.target.value); svgCanvas.setRotationAngle(e.target.value);
$('#tool_reorient').toggleClass('disabled', Number.parseInt(e.target.value) === 0); $('#tool_reorient').toggleClass('disabled', Number.parseInt(e.target.value) === 0);
}; };
@ -2750,24 +2746,11 @@ editor.init = () => {
}; };
/** /**
* @param {PlainObject} ctl * @param {PlainObject} e
* @param {string} [val=ctl.value]
* @param {boolean} noUndo
* @returns {void} * @returns {void}
*/ */
const changeBlur = function (ctl, val, noUndo) { const changeBlur = (e) => {
if (Utils.isNullish(val)) { val = ctl.value; } svgCanvas.setBlur(e.target.value / 10, true);
$('#blur').val(val);
let complete = false;
if (!ctl || !ctl.handle) {
$('#blur_slider').slider('option', 'value', val);
complete = true;
}
if (noUndo) {
svgCanvas.setBlurNoUndo(val);
} else {
svgCanvas.setBlur(val, complete);
}
}; };
$('#stroke_style').change(function () { $('#stroke_style').change(function () {
@ -2873,7 +2856,6 @@ editor.init = () => {
} else { } else {
svgCanvas.changeSelectedAttribute(attr, val); svgCanvas.changeSelectedAttribute(attr, val);
} }
// e.target.blur();
return true; return true;
}; };
@ -3135,26 +3117,6 @@ editor.init = () => {
} }
}); });
editor.addDropDown('#blur_dropdown', $.noop);
let slideStart = false;
$('#blur_slider').slider({
max: 10,
step: 0.1,
stop (evt, ui) {
slideStart = false;
changeBlur(ui);
$('#blur_dropdown li').show();
$(window).mouseup();
},
start () {
slideStart = true;
},
slide (evt, ui) {
changeBlur(ui, null, slideStart);
}
});
addAltDropDown('#stroke_linecap', '#linecap_opts', function () { addAltDropDown('#stroke_linecap', '#linecap_opts', function () {
setStrokeOpt(this, true); setStrokeOpt(this, true);
}, {dropUp: true}); }, {dropUp: true});
@ -4208,7 +4170,7 @@ editor.init = () => {
// Use this to test support for blur element. Seems to work to test support in Webkit // Use this to test support for blur element. Seems to work to test support in Webkit
const blurTest = svgdocbox.createElementNS(NS.SVG, 'feGaussianBlur'); const blurTest = svgdocbox.createElementNS(NS.SVG, 'feGaussianBlur');
if (blurTest.stdDeviationX === undefined) { if (blurTest.stdDeviationX === undefined) {
$('#tool_blur').hide(); $('#blur').hide();
} }
$(blurTest).remove(); $(blurTest).remove();
@ -4555,6 +4517,7 @@ editor.init = () => {
$id('path_node_x').addEventListener('change', (e) => attrChanger(e)); $id('path_node_x').addEventListener('change', (e) => attrChanger(e));
$id('path_node_y').addEventListener('change', (e) => attrChanger(e)); $id('path_node_y').addEventListener('change', (e) => attrChanger(e));
$id('angle').addEventListener('change', (e) => changeRotationAngle(e)); $id('angle').addEventListener('change', (e) => changeRotationAngle(e));
$id('blur').addEventListener('change', (e) => changeBlur(e));
$id('stroke_width').addEventListener('change', (e) => changeStrokeWidth(e)); $id('stroke_width').addEventListener('change', (e) => changeStrokeWidth(e));
$id('rect_rx').addEventListener('change', (e) => changeRectRadius(e)); $id('rect_rx').addEventListener('change', (e) => changeRectRadius(e));
$id('font_size').addEventListener('change', (e) => changeFontSize(e)); $id('font_size').addEventListener('change', (e) => changeFontSize(e));