blob: 05e56600a9fc4cfd336569d3ba7a3dc31a4847bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
export function calculateScale(width, height, cellSize) {
var widthScale = (cellSize * 1.0) / width
var heightScale = (cellSize * 1.0) / height
var scale = 0
if (widthScale <= heightScale) {
scale = widthScale;
} else if (heightScale < widthScale) {
scale = heightScale;
}
return scale;
}
|