GithubHelp home page GithubHelp logo

captainarbitrary / compactworktab Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 9.23 MB

This mod makes the Work tab easier to use for people who have smaller screens or lots of mods.

Home Page: https://steamcommunity.com/sharedfiles/filedetails/?id=3027381000

License: Other

C# 100.00%
rimworld rimworld-mod

compactworktab's People

Contributors

github-actions[bot] avatar jefferyharrell avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

compactworktab's Issues

Numbers support not working.

In the latest version, the mod no longer affects Numbers views.
According to another comment on the workshop page, the same is the case for Grouped Pawn Lists. It might be related.
Possibly related to #49, since shift-clicking to sort appears to work in Numbers views, when the Horizontal label option is chosen.

Toggle Grouped Pawns Lists's horizontal scroll bar with an in-game mod option

Grouped Pawns Lists's horizontal scroll bar can be controlled with this def: 1.4/Defs/PawnTableGrouped.CompatibilityInfoDef.xml

Specifically, the <allowHScroll> node, set to true or false, determines whether the Work tab will be laid out with a horizontal scroll bar.

This can be set at game startup by directly modifying the def database, but G.P.L. apparently caches the value somewhere, so changing the def at runtime has no effect.

It should be possible to reach into G.P.L. and toggle that boolean from false to true to enable the horizontal scroll bar at runtime. I just don't know how yet.

Refer to G.P.L.'s source code here: https://github.com/krypt-lynx/PawnTableGrouped

Lay out column headers at an angle instead of just 90° vertically

Here's the code for drawing a label at 90° from the horizontal:

private static void DoVerticalLabel(Rect rect, string label)
{
Matrix4x4 matrix = GUI.matrix;
GUI.matrix = Matrix4x4.identity;
Vector2 unclippedPosition = GUIClip.Unclip(Vector2.zero);
Rect topRect = GUIClip.GetTopRect();
GUI.matrix = matrix;
GUI.matrix *= Matrix4x4.TRS(unclippedPosition, Quaternion.Euler(0f, 0f, -90), Vector3.one);
GUI.matrix *= Matrix4x4.TRS(new Vector2(-rect.yMax - unclippedPosition.x, rect.xMin - unclippedPosition.y), Quaternion.identity, Vector3.one);
float leftClip = Mathf.Min(rect.xMin, 0);
float rightClip = Mathf.Max(rect.xMax - topRect.width, 0);
float topClip = Mathf.Min(rect.yMin, 0);
float bottomClip = Mathf.Max(rect.yMax - topRect.height, 0);
Rect clipRect = new Rect(bottomClip, -leftClip, rect.height + topClip - bottomClip, rect.width + leftClip - rightClip);
GUI.BeginClip(clipRect);
Rect labelRect = new Rect(-bottomClip, leftClip, rect.height, rect.width);
labelRect.x += GenUI.GapTiny;
labelRect.width += GenUI.GapTiny;
Color color = GUI.color;
TextAnchor anchor = Text.Anchor;
GameFont font = Text.Font;
GUI.color = new Color(.8f, .8f, .8f);
Text.Anchor = TextAnchor.MiddleLeft;
Text.Font = GameFont.Small;
Widgets.Label(labelRect, label);
Text.Font = font;
GUI.color = color;
Text.Anchor = anchor;
GUI.EndClip();
GUI.matrix = matrix;
}

It's pretty deep magic, and I only barely understand how it works. (Credit to krypt-lynx for the code.) Just replacing the "90" with another number does not work. More study is required.

Suggestion about the tags

image
It would be better if an alternative config was added to make the work tags incline, like the tags in the scientific chart.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.