画笔宽度和橡皮宽度适配4K分辨率

This commit is contained in:
shenjianxing 2025-05-09 14:23:17 +08:00
parent 8446452f38
commit 49c7ca4792

View File

@ -7,6 +7,7 @@ using TMPro;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using DG.Tweening; using DG.Tweening;
using System; using System;
using Org.BouncyCastle.Asn1;
namespace QFramework.Example namespace QFramework.Example
{ {
@ -169,8 +170,9 @@ namespace QFramework.Example
float sizeY = ((float)Screen.height / (float)Screen.width) * size; float sizeY = ((float)Screen.height / (float)Screen.width) * size;
ScreenShotPainter.instance.SetEraserSize(size, sizeY); ScreenShotPainter.instance.SetEraserSize(size, sizeY);
float width = Screen.width / size; float width = 1920 / size;
float height = Screen.width / size;//不缩放y轴了 float height = 1920 / size;//不缩放y轴了
Debug.LogError($"{width} : {height}");
Icon.transform.localScale = new Vector3(width / Icon.rectTransform.rect.width, height / Icon.rectTransform.rect.height, 1); Icon.transform.localScale = new Vector3(width / Icon.rectTransform.rect.width, height / Icon.rectTransform.rect.height, 1);
} }
else else
@ -180,8 +182,8 @@ namespace QFramework.Example
float sizeY = ((float)Screen.height / (float)Screen.width) * size; float sizeY = ((float)Screen.height / (float)Screen.width) * size;
ScreenShotPainter.instance.SetPaintingSize(size, sizeY); ScreenShotPainter.instance.SetPaintingSize(size, sizeY);
float width = Screen.width / size; float width = 1920 / size;
float height = Screen.width / size;//不缩放y轴了 float height = 1920 / size;//不缩放y轴了
Icon.transform.localScale = new Vector3(width / Icon.rectTransform.rect.width, height / Icon.rectTransform.rect.height, 1); Icon.transform.localScale = new Vector3(width / Icon.rectTransform.rect.width, height / Icon.rectTransform.rect.height, 1);
} }