1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:57:45 +00:00

Userland: Implement a magnifier app

This utility is useful for making sure those UI elements are pixel
perfect. A simple 2x/4x magnification around the mouse cursor, shown in
a window.
This commit is contained in:
Valtteri Koskivuori 2021-05-10 00:15:35 +03:00 committed by Linus Groh
parent 4864ef9440
commit 4d01183f5c
6 changed files with 183 additions and 0 deletions

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2021, Valtteri Koskivuori <vkoskiv@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Widget.h>
#include <LibGfx/Point.h>
class MagnifierWidget final : public GUI::Widget {
C_OBJECT(MagnifierWidget)
public:
MagnifierWidget();
virtual ~MagnifierWidget();
void set_scale_factor(int scale_factor);
void track_cursor_globally();
private:
virtual void timer_event(Core::TimerEvent&) override;
virtual void paint_event(GUI::PaintEvent&) override;
Gfx::IntPoint m_mouse_position;
int m_scale_factor { 2 };
};