microsoft/Terminal

Add clamped math methods to `til` types

Open

#5,184 建立於 2020年3月30日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)C++ (3,212 fork)batch import
Area-CodeHealthHelp WantedIssue-TaskProduct-Meta

倉庫指標

Star
 (35,764 star)
PR 合併指標
 (平均合併 27天 19小時) (30 天內合併 24 個 PR)

描述

Add a clamped sub method to til::point instead of doing it on the outside? I feel like this line should read

const auto offsetPoint = coord.ClampSub(controlOrigin);

Originally posted by @miniksa in https://github.com/microsoft/terminal/pull/5131

I moved this because I thought this comment was a generally good idea. We've got checked math operators defined on the til types already, but there are scenarios where one might want to use clamped math instead. Those callers should be able to use pointA.ClampedAdd(pointB), etc. to be able to do clamped math.

This seems like an easier solution than having some sort of other magic to say "I want a clamped point" that always does clamped math.

貢獻者指南