microsoft/Terminal

Add clamped math methods to `til` types

オープン

#5,184 opened on 2020/03/30

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)C++ (9,275 件のフォーク)batch import
Area-CodeHealthHelp WantedIssue-TaskProduct-Meta

Repository metrics

Stars
 (103,173 個のスター)
PR merge metrics
 (平均マージ 27d 19h) (30d で 24 merged PRs)

説明

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.

コントリビューターガイド