fix slider strange behavior when mouse left
also added / to all res references Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
parent
de4823e749
commit
3c0eed68ce
7 changed files with 13 additions and 10 deletions
|
@ -168,14 +168,17 @@ function createSlider(name, wrapper, options = {}) {
|
||||||
|
|
||||||
mouse.listen.window.btn.left.ondrag.on((evn) => {
|
mouse.listen.window.btn.left.ondrag.on((evn) => {
|
||||||
if (evn.initialTarget === overEl) {
|
if (evn.initialTarget === overEl) {
|
||||||
phantomRange.value = Math.max(
|
const newv = Math.max(
|
||||||
options.min,
|
options.min,
|
||||||
Math.min(
|
Math.min(
|
||||||
options.max,
|
options.max,
|
||||||
(evn.evn.layerX / wrapper.offsetWidth) * (options.max - options.min) +
|
((evn.evn.clientX - evn.initialTarget.getBoundingClientRect().left) /
|
||||||
|
wrapper.offsetWidth) *
|
||||||
|
(options.max - options.min) +
|
||||||
options.min
|
options.min
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
phantomRange.value = newv;
|
||||||
setValue(parseFloat(phantomRange.value));
|
setValue(parseFloat(phantomRange.value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,7 +37,7 @@ const _color_brush_erase_callback = (evn, state, ctx) => {
|
||||||
|
|
||||||
const colorBrushTool = () =>
|
const colorBrushTool = () =>
|
||||||
toolbar.registerTool(
|
toolbar.registerTool(
|
||||||
"res/icons/brush.svg",
|
"/res/icons/brush.svg",
|
||||||
"Color Brush",
|
"Color Brush",
|
||||||
(state, opt) => {
|
(state, opt) => {
|
||||||
// Draw new cursor immediately
|
// Draw new cursor immediately
|
||||||
|
|
|
@ -819,7 +819,7 @@ const _dream_onwheel = (evn, state) => {
|
||||||
*/
|
*/
|
||||||
const dreamTool = () =>
|
const dreamTool = () =>
|
||||||
toolbar.registerTool(
|
toolbar.registerTool(
|
||||||
"res/icons/image-plus.svg",
|
"/res/icons/image-plus.svg",
|
||||||
"Dream",
|
"Dream",
|
||||||
(state, opt) => {
|
(state, opt) => {
|
||||||
// Draw new cursor immediately
|
// Draw new cursor immediately
|
||||||
|
@ -940,7 +940,7 @@ const dreamTool = () =>
|
||||||
{
|
{
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 64,
|
max: 64,
|
||||||
step: 5,
|
step: 4,
|
||||||
textStep: 1,
|
textStep: 1,
|
||||||
}
|
}
|
||||||
).slider;
|
).slider;
|
||||||
|
@ -959,7 +959,7 @@ const dreamTool = () =>
|
||||||
|
|
||||||
const img2imgTool = () =>
|
const img2imgTool = () =>
|
||||||
toolbar.registerTool(
|
toolbar.registerTool(
|
||||||
"res/icons/image.svg",
|
"/res/icons/image.svg",
|
||||||
"Img2Img",
|
"Img2Img",
|
||||||
(state, opt) => {
|
(state, opt) => {
|
||||||
// Draw new cursor immediately
|
// Draw new cursor immediately
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const interrogateTool = () =>
|
const interrogateTool = () =>
|
||||||
toolbar.registerTool(
|
toolbar.registerTool(
|
||||||
"res/icons/microscope.svg",
|
"/res/icons/microscope.svg",
|
||||||
"Interrogate",
|
"Interrogate",
|
||||||
(state, opt) => {
|
(state, opt) => {
|
||||||
// Draw new cursor immediately
|
// Draw new cursor immediately
|
||||||
|
|
|
@ -61,7 +61,7 @@ const _mask_brush_erase_callback = (evn, state, opacity = 100) => {
|
||||||
|
|
||||||
const maskBrushTool = () =>
|
const maskBrushTool = () =>
|
||||||
toolbar.registerTool(
|
toolbar.registerTool(
|
||||||
"res/icons/paintbrush.svg",
|
"/res/icons/paintbrush.svg",
|
||||||
"Mask Brush",
|
"Mask Brush",
|
||||||
(state, opt) => {
|
(state, opt) => {
|
||||||
// Draw new cursor immediately
|
// Draw new cursor immediately
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const selectTransformTool = () =>
|
const selectTransformTool = () =>
|
||||||
toolbar.registerTool(
|
toolbar.registerTool(
|
||||||
"res/icons/box-select.svg",
|
"/res/icons/box-select.svg",
|
||||||
"Select Image",
|
"Select Image",
|
||||||
(state, opt) => {
|
(state, opt) => {
|
||||||
// Draw new cursor immediately
|
// Draw new cursor immediately
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const stampTool = () =>
|
const stampTool = () =>
|
||||||
toolbar.registerTool(
|
toolbar.registerTool(
|
||||||
"res/icons/file-up.svg",
|
"/res/icons/file-up.svg",
|
||||||
"Stamp Image",
|
"Stamp Image",
|
||||||
(state, opt) => {
|
(state, opt) => {
|
||||||
state.loaded = true;
|
state.loaded = true;
|
||||||
|
|
Loading…
Reference in a new issue