The current possible ways to change numeric values is by inputting the number manually, or scrolling while hovering above the box
I use the transform tool alot for moving parts around. It would be nice to have the ability to drag while hovering over the box to move stuff along 1 axis faster. Inputting the values requires a bit of trial and error, sometimes it’s not enough sometimes it’s moved way too far away. And scrolling while hovering over the box is way to slow.
In Blender and Davinci Resolve, you can quickly change values by simply hovering over the box, left clicking and dragging left or right. It would be so cool if Krita had this feature too for all the boxes related to selection and transformation
Just like this example in Davinci Resolve
If this doesn’t end up becoming a feature can someone please make a plugin using the existing slider thing on the brush size box and apply it to the other boxes but change the increment to sliding ratio by like half or 1 quarter, so that there’s a bit more finesse control. I kind of have an idea of what it should act like but idk the specifics of implementing it
Tiny toy plugin that adds mouse dragging to all spin boxes (Spin boxes that already have drag support are excluded ie. brush size.) Tested on Kubuntu Krita 5.2.11
How to use:
copy & paste install script to Krita’s Scripter
run script
if Scripter prints spin_style_plugin added Successfully (restarting of Krita required.) to output then install was success, else there is some error message telling what did go wrong.
future ideas:
change mouse cursor to nice arrows when hovering over spin boxes
better step size control.
from pathlib import Path
from krita import Krita
app = Krita.instance()
user_pykrita_path = Path(app.getAppDataLocation()) / 'pykrita'
plugin_init_path = user_pykrita_path / 'spin_style_plugin' / '__init__.py'
plugin_desktop_path = user_pykrita_path / 'spin_style_plugin.desktop'
plugin_init_path.parent.mkdir()
plugin_init_path.write_text("""\
from krita import (
Krita,
Extension)
from PyQt5.QtCore import (
Qt,
QPointF,
QEvent)
from PyQt5.QtGui import (
QPalette,)
from PyQt5.QtWidgets import (
QProxyStyle,
QDoubleSpinBox,
QSpinBox,
QAbstractSpinBox,
QApplication,
QWidget)
class SpinStyleExtension(Extension):
def setup(self):
QApplication.setStyle(SpinStyle(QApplication.style()))
def createActions(self, window):
...
class SpinStyle(QProxyStyle):
_prev_pos = QPointF()
def _is_target_spin_box(self, obj):
if isinstance(obj, (QDoubleSpinBox, QSpinBox)):
# exclude spin boxes that already have drag support.
if not obj.inherits('KisSliderSpinBox') and not obj.inherits('KisDoubleSliderSpinBox'):
return True
return False
def polish(self, obj):
if isinstance(obj, QPalette):
return QPalette() # bug in Qt?
elif self._is_target_spin_box(obj):
obj.installEventFilter(self)
for w in obj.findChildren(QWidget):
w.installEventFilter(self)
return None
def unpolish(self, obj):
if self._is_target_spin_box(obj):
obj.removeEventFilter(self)
for w in obj.findChildren(QWidget):
w.removeEventFilter(self)
def eventFilter(self, obj, event):
if (event.type() == QEvent.MouseButtonPress) and (event.button() & Qt.LeftButton):
self._prev_pos = event.localPos()
elif (event.type() == QEvent.MouseMove) and (event.buttons() & Qt.LeftButton):
pos = event.localPos()
delta_pos = self._prev_pos - pos
self._prev_pos = pos
if self._is_target_spin_box(obj):
obj.stepBy(int(-delta_pos.x()))
else:
parent = obj.parent()
if self._is_target_spin_box(parent):
parent.stepBy(int(-delta_pos.x()))
return super().eventFilter(obj, event)
def register():
app = Krita.instance()
app.addExtension(SpinStyleExtension(app))
register()
""")
plugin_desktop_path.write_text("""\
[Desktop Entry]
Type=Service
ServiceTypes=Krita/PythonPlugin
X-KDE-Library=spin_style_plugin
X-Python-2-Compatible=false
X-Krita-Manual=readme.md
Name=Spin Style Plugin
Comment=Adds mouse dragging to spin box widgets.
""")
app.writeSetting('python', 'enable_spin_style_plugin', 'true')
print('spin_style_plugin added Successfully (restarting of Krita required.)')
edit: code had errors in excluding KisSliderSpinBox and KisDoubleSliderSpinBox, now fixed.
I like this idea, since spin boxes are kind of fiddly to operate without a keyboard, but how do those programs handle inputting numbers directly? Like, currently in Krita, when you drag horizontally over a spin box, you select the text in it, but evidently you can’t do that if dragging instead changes the value.
Double clicking let’s you input numbers directly, it’s already a thing for Krita brush size sliders. For Davinci both double clicking and single clicking on the box let’s you input direct numbers, but for Blender it’s clicking once
I had a go with having clicking once select the entire text, which feels good to me. It’ll select the entire text to begin with, but that’s probably what you usually want anyway, or certainly it’s a more common thing to want to do than select a small part out of the text. And dragging over it makes these spinners much easier usable.
I’ve stuck them into Drawpile for now, it uses the same sliders and I’ll see how users react to it. If it has a positive response, I think it’d be worth also sticking them into Krita, although it’s a lot more work to replace the sheer amount of them across the program.