mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
FancyZones and Shortcut Guide initial commit
Co-authored-by: Alexis Campailla <alexis@janeasystems.com> Co-authored-by: Bret Anderson <bretan@microsoft.com> Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Jeff Bogdan <jeffbog@microsoft.com> Co-authored-by: March Rogers <marchr@microsoft.com> Co-authored-by: Mike Harsh <mharsh@microsoft.com> Co-authored-by: Nachum Bundak <Nachum.Bundak@microsoft.com> Co-authored-by: Oliver Jones <ojones@microsoft.com> Co-authored-by: Patrick Little <plittle@microsoft.com>
This commit is contained in:
committed by
Bartosz Sosnowski
parent
10c5396099
commit
8431b80e48
46
src/modules/fancyzones/editor/FancyZonesEditor/RowColInfo.cs
Normal file
46
src/modules/fancyzones/editor/FancyZonesEditor/RowColInfo.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FancyZonesEditor
|
||||
{
|
||||
public class RowColInfo
|
||||
{
|
||||
public RowColInfo(int percent)
|
||||
{
|
||||
Percent = percent;
|
||||
}
|
||||
|
||||
public RowColInfo(int index, int count)
|
||||
{
|
||||
Percent = (c_multiplier / count) + ((index == 0) ? (c_multiplier % count) : 0);
|
||||
}
|
||||
|
||||
private const int c_multiplier = 10000;
|
||||
|
||||
public double SetExtent(double start, double totalExtent)
|
||||
{
|
||||
Start = start;
|
||||
Extent = totalExtent * Percent / c_multiplier;
|
||||
End = Start + Extent;
|
||||
return Extent;
|
||||
}
|
||||
|
||||
public RowColInfo[] Split(double offset)
|
||||
{
|
||||
RowColInfo[] info = new RowColInfo[2];
|
||||
|
||||
int newPercent = (int)(Percent * offset / Extent);
|
||||
info[0] = new RowColInfo(newPercent);
|
||||
info[1] = new RowColInfo(Percent - newPercent);
|
||||
return info;
|
||||
}
|
||||
|
||||
public int Percent;
|
||||
public double Extent;
|
||||
public double Start;
|
||||
public double End;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user