Use native arrow cursors for game surfaces and controls (by Codex)
This commit is contained in:
1 parent
012612b06f
commit
6f98f894f2
6 files changed
+48
-6
No files matched your search
@@ -11,7 +11,7 @@ select selectarrow {width:10dp;height:10dp;border-bottom:2dp var(--muted);border
|
||||
.native-select-menu>.native-select-option {display:flex;align-items:center;justify-content:flex-start;gap:12dp;width:100%;min-height:72dp;margin:0;padding:10dp 14dp;border:0dp;border-radius:8dp;background-color:transparent;color:var(--text);text-align:left;font-size:1em;line-height:1.3;tab-index:none;}
|
||||
.native-select-menu.league>.native-select-option {gap:12dp;padding:10dp 14dp;border-radius:10dp;}
|
||||
.native-select-menu>.native-select-option:hover,.native-select-menu>.native-select-option.is-cursor,.native-select-menu>.native-select-option:focus {background-color:var(--select-popup-hover);}
|
||||
.native-select-menu>.native-select-option:disabled {opacity:0.4;cursor:default;background-color:transparent;}
|
||||
.native-select-menu>.native-select-option:disabled {opacity:0.4;cursor:arrow;background-color:transparent;}
|
||||
.native-select-check {display:flex;align-items:center;justify-content:center;width:28dp;min-width:28dp;flex-shrink:0;color:var(--accent);}
|
||||
.native-select-menu.league .native-select-check {width:34dp;min-width:34dp;}
|
||||
.native-select-check>.image-frame {flex-shrink:0;}
|
||||
|
||||
@@ -24,16 +24,16 @@ body.matchday {
|
||||
#background {position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;}
|
||||
#canvas {position:absolute;width:3840dp;height:2160dp;overflow:hidden;}
|
||||
button,input,select,textarea {font-family:Modern;color:var(--text);font-size:32dp;}
|
||||
button {padding:16dp 26dp;background-color:var(--soft);border:2dp var(--border);border-radius:14dp;cursor:pointer;text-align:center;tab-index:auto;}
|
||||
button {padding:16dp 26dp;background-color:var(--soft);border:2dp var(--border);border-radius:14dp;cursor:arrow;text-align:center;tab-index:auto;}
|
||||
.control-button {display:flex;align-items:center;justify-content:center;}
|
||||
.control-label {display:block;}
|
||||
.choice.control-button {justify-content:flex-start;}
|
||||
button:hover {background-color:var(--hover);}
|
||||
button:disabled,button[disabled] {opacity:0.4;cursor:default;tab-index:none;}
|
||||
button:disabled,button[disabled] {opacity:0.4;cursor:arrow;tab-index:none;}
|
||||
button:focus-visible,input:focus-visible,select:focus-visible {border-color:var(--accent);}
|
||||
button.primary {background-color:var(--selected);border-color:var(--accent);}
|
||||
input,select,textarea {padding:14dp 20dp;border:2dp var(--border);border-radius:12dp;background-color:var(--input);tab-index:auto;}
|
||||
select {width:520dp;padding-right:45dp;}
|
||||
select {cursor:arrow;width:520dp;padding-right:45dp;}
|
||||
.row select,.toolbar select {flex:1;min-width:0;}
|
||||
select selectvalue {padding-right:24dp;}
|
||||
select selectarrow {width:10dp;height:10dp;margin-right:-12dp;margin-top:6dp;border-bottom:2dp var(--muted);border-right:2dp var(--muted);transform:rotate(45deg);}
|
||||
@@ -157,3 +157,8 @@ body.silver .app-tile {border-color:#edf7ff99;}
|
||||
.gallery-card h2 {font-size:32dp;margin-bottom:24dp;}
|
||||
.gallery-card p {font-size:26dp;color:var(--muted);margin:15dp 0;}
|
||||
.gallery-card button {font-size:26dp;}
|
||||
|
||||
label,input[type=checkbox],input[type=radio],input[type=range] {cursor:arrow;}
|
||||
/* Native SDL names: game controls use arrow, editing retains the I-beam. */
|
||||
input[type=text],input[type=search],input[type=number],input[type=password],textarea {cursor:text;}
|
||||
a[href] {cursor:pointer;}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only */
|
||||
.info-bar {z-index:1000;}
|
||||
.desk-card {cursor:pointer;}
|
||||
.desk-card {cursor:arrow;}
|
||||
.desk-card:focus-visible {border-color:var(--accent);}
|
||||
.desk-card-heading {height:70dp;display:flex;align-items:center;justify-content:space-between;gap:20dp;padding:22dp 30dp 12dp;font-size:25dp;line-height:1.2;color:var(--muted);}
|
||||
.desk-card-heading>span {display:block;min-width:0;flex:1;white-space:nowrap;overflow:hidden;}
|
||||
|
||||
@@ -69,3 +69,5 @@ und Stand der Engine in [new_engine](../new_engine/README.md).
|
||||
- [Tatsächliche Hallentabellen](desktop/indoor/ENGINE.md): Original-Punkterangliste, Turnierwertung und Kaderabsprung.
|
||||
|
||||
- [Tatsächliche Einstellungen/Automatik](desktop/settings/ENGINE.md): Originalgrenzen, Entwurf und atomare Übernahme.
|
||||
|
||||
- [Mauszeiger](controls/cursors.md): Pfeil für Spielaktionen, Textcursor für Eingaben, keine Hyperlink-Hand auf Spielflächen.
|
||||
@@ -0,0 +1,8 @@
|
||||
<!-- SPDX-License-Identifier: GPL-3.0-only -->
|
||||
# Mauszeiger der Spieloberfläche
|
||||
|
||||
Normale Spielschaltflächen, unsichtbare Bildflächen, Widgets und Dropdowns verwenden den gewöhnlichen Pfeil. Das gilt auch für gesperrte Optionen. Die Oberfläche signalisiert keine Weblink-Hand für Spielaktionen. Texteingaben behalten den Textcursor; tatsächliche Links können den Linkcursor verwenden.
|
||||
|
||||
Native RmlUI-Styles benutzen dafür `arrow`, passend zu `SystemInterface_SDL`. Ein CSS-ähnliches `default` ist kein dort behandelter Cursorname und darf nicht als Rücksetzung vorausgesetzt werden. Der gemeinsame Eingabetest prüft echte Hit-Tests und den Cursor-Callback beim Wechsel vom Link zu aktiven/gesperrten Buttons, Widget und Dropdown sowie anschließend zum Textfeld, jeweils in drei Themes bei vier Dichten.
|
||||
|
||||
Die HTML-Referenz lädt `cursor-policy.css` zuletzt. Diese Richtlinie überschreibt Skin-spezifische Handzeiger für Spielaktionen und erhält Text-/Linkcursor sowie den aktiven Ziehzustand. Geometrie, Daten, Spielregeln und Renderer bleiben unverändert. Framebufferaufnahmen enthalten den OS-Zeiger nicht; die interaktive Windows-Abnahme bleibt Human QA.
|
||||
@@ -40,6 +40,8 @@ struct Renderer final : Rml::RenderInterface {
|
||||
};
|
||||
struct System final : Rml::SystemInterface {
|
||||
size_t stylesheet_errors = 0;
|
||||
Rml::String cursor;
|
||||
void SetMouseCursor(const Rml::String &name) override { cursor=name; }
|
||||
bool LogMessage(Rml::Log::Type type, const Rml::String &message) override {
|
||||
if ((type == Rml::Log::LT_WARNING || type == Rml::Log::LT_ERROR) &&
|
||||
(message.find("property") != message.npos ||
|
||||
@@ -98,6 +100,30 @@ struct ClickListener final : Rml::EventListener {
|
||||
++clicks;
|
||||
}
|
||||
};
|
||||
void cursor_cases(Rml::Context &context, System &system,
|
||||
const std::string &css, const std::string &theme, float density) {
|
||||
auto *doc=context.LoadDocumentFromMemory(
|
||||
"<rml><head><style>"+css+"</style></head><body class='"+theme+"'>"
|
||||
"<a id='cursor-link' href='https://example.invalid/' style='cursor:pointer;position:absolute;left:40dp;top:40dp;width:300dp;height:80dp;'>Web link</a>"
|
||||
"<button id='cursor-button' style='position:absolute;left:40dp;top:160dp;width:300dp;height:80dp;'>Game action</button>"
|
||||
"<button id='cursor-disabled' disabled style='position:absolute;left:40dp;top:280dp;width:300dp;height:80dp;'>Unavailable</button>"
|
||||
"<div id='cursor-widget' class='desk-card' style='position:absolute;left:40dp;top:400dp;width:300dp;height:80dp;'>Widget</div>"
|
||||
"<select id='cursor-select' style='position:absolute;left:40dp;top:520dp;width:300dp;height:80dp;'><option>Choice</option></select>"
|
||||
"<input id='cursor-input' type='text' value='Manager' style='position:absolute;left:40dp;top:640dp;width:300dp;height:80dp;'/>"
|
||||
"</body></rml>");
|
||||
require(doc,"Cursor fixture missing");doc->Show();context.Update();
|
||||
const auto hover=[&](const char *id) {
|
||||
auto *node=doc->GetElementById(id);const auto p=node->GetAbsoluteOffset(Rml::BoxArea::Border),s=node->GetBox().GetSize(Rml::BoxArea::Border);
|
||||
context.ProcessMouseMove(int(p.x+s.x/2),int(p.y+s.y/2),0);context.Update();
|
||||
};
|
||||
for(auto *id:{"cursor-button","cursor-disabled","cursor-widget","cursor-select"}) {
|
||||
hover("cursor-link");require(system.cursor=="pointer","Actual link lost its pointer");
|
||||
hover(id);require(system.cursor=="arrow","Game control retained hyperlink/stale cursor");
|
||||
}
|
||||
hover("cursor-input");require(system.cursor=="text","Text field lost editing cursor");
|
||||
doc->Close();context.Update();
|
||||
(void)density;
|
||||
}
|
||||
void script_locator_cases(Rml::Context &context, float density) {
|
||||
struct Case {
|
||||
const char *transform;
|
||||
@@ -366,11 +392,12 @@ int main(int argc, char **argv) try {
|
||||
}
|
||||
doc->Close();
|
||||
context->Update();
|
||||
cursor_cases(*context,system,css.str(),theme,density);
|
||||
script_locator_cases(*context,density);
|
||||
Rml::RemoveContext("controls");
|
||||
}
|
||||
Rml::Shutdown();
|
||||
std::cout << "Control text, dropdown arrows, popup fonts and rich cards "
|
||||
std::cout << "Control cursors, text, dropdown arrows, popup fonts and rich cards "
|
||||
"passed in 3 themes at 4 densities\n";
|
||||
} catch (const std::exception &e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
|
||||
Reference in new issue
Block a user