Fallos gráficos de NSScroller / retraso
-
05-07-2019 - |
Pregunta
Tengo la siguiente subclase de NSScroller que crea una barra de desplazamiento con un botón blanco redondeado y sin flechas / ranura (fondo):
@implementation IGScrollerVertical
- (void)drawKnob
{
NSRect knobRect = [self rectForPart:NSScrollerKnob];
NSRect newRect = NSMakeRect(knobRect.origin.x, knobRect.origin.y, knobRect.size.width - 4, knobRect.size.height);
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:newRect xRadius:7 yRadius:7];
[[NSColor whiteColor] set];
[path fill];
}
- (void)drawArrow:(NSScrollerArrow)arrow highlightPart:(int)flag
{
// We don't want arrows
}
- (void)drawKnobSlotInRect:(NSRect)rect highlight:(BOOL)highlight
{
// Don't want a knob background
}
@end
Todo esto funciona bien, excepto que hay un retraso notable cuando uso la rueda de desplazamiento. Vea este video:
Estoy confundido en cuanto a lo que estoy haciendo mal, ¿alguna sugerencia?
Solución
Se solucionó el problema, solo tenía que llenar el rect en drawKnobSlotInRect:
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow