Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add constrain for wechat logo default ratio #15627

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions templates/wechatgame/first-screen.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ function initProgressVertexBuffer() {
}

function updateVertexBuffer() {
// the ratio value may be adjusted according to the expected image display effect
const widthRatio = image.width / canvas.width * 1.35 * displayRatio;
const heightRatio = image.height / canvas.height * 1.35 * displayRatio;
// By default, maintain aspect ratio by constraining display at 200px height
const defaultRatio = 200 / image.height;
const widthRatio = image.width / canvas.width * 1.35 * defaultRatio * displayRatio;
const heightRatio = image.height / canvas.height * 1.35 * defaultRatio * displayRatio;
const heightOffset = 1/6; // canvas:(-1,1) -> (button, top); heightOffset = (5/12) * (-2) + 1 = 1/6
const vertices = new Float32Array([
widthRatio, heightOffset - heightRatio, 1.0, 1.0,
Expand Down
Loading