第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

為什么我的畫布在將 html 轉(zhuǎn)換為 DOM 調(diào)用時(shí)會(huì)自行縮放?

為什么我的畫布在將 html 轉(zhuǎn)換為 DOM 調(diào)用時(shí)會(huì)自行縮放?

翻過高山走不出你 2024-01-18 20:34:02
在重構(gòu)我的代碼以避免調(diào)用該innerHtml成員時(shí),一個(gè)新的錯(cuò)誤出現(xiàn)了。我只將 html 字符串轉(zhuǎn)換為 DOM 調(diào)用。鉻檢查器中不會(huì)拋出錯(cuò)誤。我使用的是mercurial,舊版本仍然有效。我四處搜尋并發(fā)現(xiàn):alert(ctx.getTransform());返回1,0,0,1,0,0恒等變換。但我的畫布縮放比例仍然錯(cuò)誤。除了基本的線和筆畫成員之外,我不會(huì)稱呼任何其他東西。function buildColorTool() {    var pick = document.createElement("DIV");    var canvas = document.createElement("canvas");    canvas.style.width = "200px";    canvas.style.height = "200px";    canvas.id = "wheelCanvas";    pick.appendChild(canvas);    document.getElementById("toolWindow").appendChild(pick);}已損壞,但是: function buildColorTool() {    let toolWindow = "<div class=\"toolDialogue\">";    toolWindow += " <div id=\"colorPicker\">";    toolWindow += "     <canvas id=\"wheelCanvas\" width=\"200\" height=\"200\"></canvas>";    toolWindow += " </div>";    toolWindow += " </div>";    document.getElementById("toolWindow").innerHTML = toolWindow; }作品。我使用過hg diff -c 25 ./script.js > changes.txt,是否有更好的一組用于發(fā)布到堆棧交換的多變參數(shù)?
查看完整描述

1 回答

?
慕雪6442864

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊

問題是,您通過元素的樣式標(biāo)簽設(shè)置元素的寬度和高度。然而,這會(huì)導(dǎo)致畫布元素出現(xiàn)問題。通常,高度和寬度屬性用于實(shí)際大小調(diào)整,CSS寬度/高度用于縮放。

解決方案?變更

function newColorCanvas() {

? ?var pick = document.createElement("DIV");


? ?var canvas = document.createElement("canvas");

? ?canvas.style.width = "200px";

? ?canvas.style.height = "200px";

? ?canvas.id = "wheelCanvas";

? ?canvas.innerText = "Canvas tag not supported";

? ?pick.appendChild(canvas);


? ?var select = document.createElement("P");

? ?select.id = "colorSelection";

? ?select.innerText = "HSL: 135, 75, 50";

? ?pick.appendChild(select);


? ?document.getElementById("toolWindow").appendChild(pick);


? ?paintCanvas(135,75,50);

? ?canvas.addEventListener('click', function() {updateCanvas();});

}


function newColorCanvas() {

? ?var pick = document.createElement("DIV");


? ?var canvas = document.createElement("canvas");

? ?canvas.width = 200;

? ?canvas.height = 200;

? ?canvas.id = "wheelCanvas";

? ?canvas.innerText = "Canvas tag not supported";

? ?pick.appendChild(canvas);


? ?var select = document.createElement("P");

? ?select.id = "colorSelection";

? ?select.innerText = "HSL: 135, 75, 50";

? ?pick.appendChild(select);


? ?document.getElementById("toolWindow").appendChild(pick);


? ?paintCanvas(135,75,50);

? ?canvas.addEventListener('click', function() {updateCanvas();});

}


查看完整回答
反對(duì) 回復(fù) 2024-01-18
  • 1 回答
  • 0 關(guān)注
  • 239 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)