Update jQuery.jGraduate.js

master
JFH 2020-12-24 22:24:10 +01:00
parent 00d98958f2
commit 1a938fc522
1 changed files with 10 additions and 10 deletions

View File

@ -481,7 +481,7 @@ export default function jQueryPluginJGraduate ($) {
case 'linearGradient': case 'linearGradient':
if (!isSolid) { if (!isSolid) {
curGradient.id = id + '_lg_jgraduate_grad'; curGradient.id = id + '_lg_jgraduate_grad';
grad = curGradient = svg.appendChild(curGradient); // .cloneNode(true)); grad = curGradient = svg.appendChild(curGradient);
} }
mkElem('radialGradient', { mkElem('radialGradient', {
id: id + '_rg_jgraduate_grad' id: id + '_rg_jgraduate_grad'
@ -491,7 +491,7 @@ export default function jQueryPluginJGraduate ($) {
case 'radialGradient': case 'radialGradient':
if (!isSolid) { if (!isSolid) {
curGradient.id = id + '_rg_jgraduate_grad'; curGradient.id = id + '_rg_jgraduate_grad';
grad = curGradient = svg.appendChild(curGradient); // .cloneNode(true)); grad = curGradient = svg.appendChild(curGradient);
} }
mkElem('linearGradient', { mkElem('linearGradient', {
id: id + '_lg_jgraduate_grad' id: id + '_lg_jgraduate_grad'
@ -736,7 +736,7 @@ export default function jQueryPluginJGraduate ($) {
const path = $wc(curStop); const path = $wc(curStop);
const stop = path.data('stop'); const stop = path.data('stop');
const bg = path.data('bg'); const bg = path.data('bg');
$wc([curStop, stop, bg]).remove(); $([curStop, stop, bg]).remove();
} }
const stopMakerDiv = $wc('#' + id + '_jGraduate_StopSlider'); const stopMakerDiv = $wc('#' + id + '_jGraduate_StopSlider');
@ -976,22 +976,22 @@ export default function jQueryPluginJGraduate ($) {
previewRect.setAttribute('fill-opacity', gradalpha / 100); previewRect.setAttribute('fill-opacity', gradalpha / 100);
$wc(id + ' div.grad_coord').mousedown(function (evt) { $wc('#' + id + ' div.grad_coord').mousedown(function (evt) {
evt.preventDefault(); evt.preventDefault();
draggingCoord = $wc(this); draggingCoord = $(this);
// const sPos = draggingCoord.offset(); // const sPos = draggingCoord.offset();
offset = draggingCoord.parent().offset(); offset = draggingCoord.parent().offset();
$win.mousemove(onCoordDrag).mouseup(onCoordUp); $win.mousemove(onCoordDrag).mouseup(onCoordUp);
}); });
// bind GUI elements // bind GUI elements
$wc(id + '_jGraduate_Ok').bind('click', function () { $wc('#' + id + '_jGraduate_Ok').bind('click', function () {
$this.paint.type = curType; $this.paint.type = curType;
$this.paint[curType] = curGradient.cloneNode(true); $this.paint[curType] = curGradient.cloneNode(true);
$this.paint.solidColor = null; $this.paint.solidColor = null;
okClicked(); okClicked();
}); });
$wc(id + '_jGraduate_Cancel').bind('click', function (paint) { $wc('#' + id + '_jGraduate_Cancel').bind('click', function (paint) {
cancelClicked(); cancelClicked();
}); });
@ -1152,13 +1152,13 @@ export default function jQueryPluginJGraduate ($) {
}; };
$.each(sliders, function (type, data) { $.each(sliders, function (type, data) {
const handle = $wc(data.handle); const handle = $(data.handle);
handle.mousedown(function (evt) { handle.mousedown(function (evt) {
const parent = handle.parent(); const parent = handle.parent();
slider = { slider = {
type, type,
elem: handle, elem: handle,
input: $wc(data.input), input: $(data.input),
parent, parent,
offset: parent.offset() offset: parent.offset()
}; };
@ -1166,7 +1166,7 @@ export default function jQueryPluginJGraduate ($) {
evt.preventDefault(); evt.preventDefault();
}); });
$wc(data.input).val(data.val).change(function () { $(data.input).val(data.val).change(function () {
const isRad = curType === 'radialGradient'; const isRad = curType === 'radialGradient';
let val = Number(this.value); let val = Number(this.value);
let xpos = 0; let xpos = 0;