This commit is contained in:
Nicola
2021-12-12 18:37:16 +01:00
parent 1bac62be4c
commit be852d9aae
8 changed files with 109 additions and 64 deletions

View File

@ -354,7 +354,7 @@ const ColorPicker = (() => {
function movePickerIcon(event) {
event.preventDefault();
if (event.which == 1 || draggingCursor) {
if (event.buttons == 1 || draggingCursor) {
let cursorPos = getCursorPosMinipicker(event);
let canvasRect = miniPickerCanvas.getBoundingClientRect();
@ -507,6 +507,10 @@ const ColorPicker = (() => {
styles[1] += "background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(0,0,0,1) 0%, " +
"rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ",1) 100%);}";
styles[1] += "input[type=range]#cp-minipicker-slider::-moz-range-track { background: rgb(2,0,36);";
styles[1] += "background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(0,0,0,1) 0%, " +
"rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ",1) 100%);}";
updateMiniPickerSpectrum();
updateStyles();
}

View File

@ -141,11 +141,11 @@ const PaletteBlock = (() => {
* @param {*} mouseEvent
*/
function updateRampSelection(mouseEvent) {
if (mouseEvent != null && mouseEvent.which == 3) {
if (mouseEvent != null && mouseEvent.buttons == 2) {
currentSelection.endIndex = getElementIndex(mouseEvent.target);
}
if (mouseEvent == null || mouseEvent.which == 3) {
if (mouseEvent == null || mouseEvent.buttons == 2) {
let startCoords = getColourCoordinates(currentSelection.startIndex);
let endCoords = getColourCoordinates(currentSelection.endIndex);

View File

@ -24,7 +24,7 @@ const ToolManager = (() => {
Events.on("mouseup", window, onMouseUp);
Events.on("mousemove", window, onMouseMove);
Events.on("mousedown", window, onMouseDown);
Events.on("mousewheel", window, onMouseWheel);
Events.on("wheel", window, onMouseWheel);
// Bind tool shortcuts
Events.onCustom("tool-shortcut", onShortcut);
@ -36,6 +36,7 @@ const ToolManager = (() => {
}
function onMouseWheel(mouseEvent) {
console.log("MOUSE WHEEL");
if (!EditorState.documentCreated || Dialogue.isOpen())
return;
@ -82,7 +83,7 @@ const ToolManager = (() => {
currTool.onHover(mousePos, mouseEvent.target);
if (Input.isDragging()) {
switch (mouseEvent.which) {
switch (mouseEvent.buttons) {
case 1:
if (Input.isSpacePressed()) {
tools["pan"].onDrag(mousePos, mouseEvent.target);
@ -94,10 +95,10 @@ const ToolManager = (() => {
currTool.onDrag(mousePos, mouseEvent.target);
}
break;
case 2:
case 4:
tools["pan"].onDrag(mousePos, mouseEvent.target);
break;
case 3:
case 2:
currTool.onRightDrag(mousePos, mouseEvent.target);
break;
default: