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

fix: ペースト画像が空の状態でラジオボタンを押したら画像生成される不具合修正 #23

Merged
merged 1 commit into from
Nov 23, 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
8 changes: 4 additions & 4 deletions docs/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
$(function () {
var gCanvas = document.querySelector("canvas#output-image");
var gPastedImage = document.querySelector("img#pasted-image");
var gPastedImage = document.querySelector("img#img__lgtn");
const selectedOverlayImageValue = () =>
document.querySelector('input[name="chooseOverlay"]:checked').value;
const getOverlayImage = () => document.querySelector(`img#img__${selectedOverlayImageValue()}`);

const setMessage = (message) => {
const elem = document.querySelector("#paste-area-message");
Expand Down Expand Up @@ -50,10 +50,10 @@ $(function () {
};

const drawCanvas = function () {
const imgEl = document.querySelector("#pasted-image");
const imgEl = gPastedImage
const selectedImageId = selectedOverlayImageValue();
const lgtnEl = document.querySelector(`#img__${selectedImageId}`);
const canvas = document.querySelector("#output-image");
const lgtnEl = getOverlayImage()
const canvas = gCanvas
const context = canvas.getContext("2d");

// 画像のアスペクト比から描画する位置決めをする
Expand Down