Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
실시간 편집
변경 없는 행 숨기기
줄바꿈 비활성화
레이아웃
나란히 보기
합쳐 보기
비교 단위
스마트
단어
글자
구문 강조
언어 선택
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
Untitled diff
생성일
11년 전
비교 결과 만료 없음
초기화
내보내기
공유
설명
28 삭제
행
총
삭제
글자
총
삭제
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
75 행
복사
10 추가
행
총
추가
글자
총
추가
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
72 행
복사
// construtor de canvas
// construtor de canvas
function Canvas(cWidth, cHeigth, canvasID, M) {
function Canvas(cWidth, cHeigth, canvasID, M) {
this.canvas = document.createElement('canvas');
this.canvas = document.createElement('canvas');
복사
복사됨
복사
복사됨
document.body.appendChild(this.canvas);
// Se uma altura/largura nao forem setados, o tamanho da tela é usado com base para o canvas.
// Se uma altura/largura nao forem setados, o tamanho da tela é usado com base para o canvas.
this.canvas.width = cWidth || window.innerWidth - M;
this.canvas.width = cWidth || window.innerWidth - M;
this.canvas.height = cHeigth || window.innerHeight - M;
this.canvas.height = cHeigth || window.innerHeight - M;
this.context = this.canvas.getContext('2d');
this.context = this.canvas.getContext('2d');
this.canvas.style.border = "1px solid";
this.canvas.style.border = "1px solid";
this.canvas.id = canvasID; // or use name
this.canvas.id = canvasID; // or use name
복사
복사됨
복사
복사됨
this.canvas
.addEventListener('click', click.bind(this))
document.body.appendChild(
this.canvas
);
//Limpa o canvas a cada frame.
//Limpa o canvas a cada frame.
this.upC = function() {
this.upC = function() {
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
}
}
//cria um retangulo (preguiça de escrever).
//cria um retangulo (preguiça de escrever).
this.rect = function(x, y, w, h) {
this.rect = function(x, y, w, h) {
this.context.fillRect(x, y, w, h);
this.context.fillRect(x, y, w, h);
}
}
복사
복사됨
복사
복사됨
this.rectNav = this.canvas.getBoundingClientRect()
this.rectNav = this.canvas.getBoundingClientRect()
복사
복사됨
복사
복사됨
}
}
// construtor de botoes
// construtor de botoes
function Botao(x, y, w, h, canvas, callback, color) {
function Botao(x, y, w, h, canvas, callback, color) {
this.x = x;
this.x = x;
this.y = y;
this.y = y;
this.w = w;
this.w = w;
this.h = h;
this.h = h;
this.cb = callback;
this.cb = callback;
this.color = color;
this.color = color;
this.render = function() {
this.render = function() {
canvas.context.fillStyle = color || '#000';
canvas.context.fillStyle = color || '#000';
canvas.rect(this.x, this.y, this.w, this.h);
canvas.rect(this.x, this.y, this.w, this.h);
}
}
this.ontarget = function(pos) {
this.ontarget = function(pos) {
if (pos.x > this.x && pos.x < (this.x + this.w) && pos.y > this.y && pos.y < (this.y + this.h)) {
if (pos.x > this.x && pos.x < (this.x + this.w) && pos.y > this.y && pos.y < (this.y + this.h)) {
this.cb();
this.cb();
};
};
}
}
복사
복사됨
복사
복사됨
}
var teste = new Canvas(400, 300,
teste
, 0);
var teste = new Canvas(400, 300,
'minhaID'
, 0);
var bt1 = new Botao(100, 100, 100, 100, teste, function() {
var bt1 = new Botao(100, 100, 100, 100, teste, function() {
console.log("teste");
console.log("teste");
});
});
복사
복사됨
복사
복사됨
function run() {
function run() {
teste.upC();
teste.upC();
복사
복사됨
복사
복사됨
bt1.render(); // renderiza o botao.
bt1.render(); // renderiza o botao.
window.requestAnimationFrame(run);
window.requestAnimationFrame(run);
}
}
run();
run();
복사
복사됨
복사
복사됨
function click(evt) {
function click(evt) {
var rectNav =
teste
.rectNav;; //obtêm as coordenadas do mouse na janela do cliente.
var rectNav =
this
.rectNav;; //obtêm as coordenadas do mouse na janela do cliente.
var pos = {
var pos = {
x: evt.clientX - rectNav.left,
x: evt.clientX - rectNav.left,
y: evt.clientY - rectNav.top
y: evt.clientY - rectNav.top
};
};
복사
복사됨
복사
복사됨
bt1.ontarget(pos); //detecta se o click foi no botão
bt1.ontarget(pos); //detecta se o click foi no botão
}
}
복사
복사됨
복사
복사됨
cEvent('click', click);
//
cEvent('click', click);
저장된 비교 결과
원본
파일 열기
// construtor de canvas function Canvas(cWidth, cHeigth, canvasID, M) { this.canvas = document.createElement('canvas'); // Se uma altura/largura nao forem setados, o tamanho da tela é usado com base para o canvas. this.canvas.width = cWidth || window.innerWidth - M; this.canvas.height = cHeigth || window.innerHeight - M; this.context = this.canvas.getContext('2d'); this.canvas.style.border = "1px solid"; this.canvas.id = canvasID; // or use name document.body.appendChild(this.canvas); //Limpa o canvas a cada frame. this.upC = function() { this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); } //cria um retangulo (preguiça de escrever). this.rect = function(x, y, w, h) { this.context.fillRect(x, y, w, h); } this.rectNav = this.canvas.getBoundingClientRect() } // construtor de botoes function Botao(x, y, w, h, canvas, callback, color) { this.x = x; this.y = y; this.w = w; this.h = h; this.cb = callback; this.color = color; this.render = function() { canvas.context.fillStyle = color || '#000'; canvas.rect(this.x, this.y, this.w, this.h); } this.ontarget = function(pos) { if (pos.x > this.x && pos.x < (this.x + this.w) && pos.y > this.y && pos.y < (this.y + this.h)) { this.cb(); }; } var teste = new Canvas(400, 300, teste, 0); var bt1 = new Botao(100, 100, 100, 100, teste, function() { console.log("teste"); }); function run() { teste.upC(); bt1.render(); // renderiza o botao. window.requestAnimationFrame(run); } run(); function click(evt) { var rectNav = teste.rectNav;; //obtêm as coordenadas do mouse na janela do cliente. var pos = { x: evt.clientX - rectNav.left, y: evt.clientY - rectNav.top }; bt1.ontarget(pos); //detecta se o click foi no botão } cEvent('click', click);
수정본
파일 열기
// construtor de canvas function Canvas(cWidth, cHeigth, canvasID, M) { this.canvas = document.createElement('canvas'); document.body.appendChild(this.canvas); // Se uma altura/largura nao forem setados, o tamanho da tela é usado com base para o canvas. this.canvas.width = cWidth || window.innerWidth - M; this.canvas.height = cHeigth || window.innerHeight - M; this.context = this.canvas.getContext('2d'); this.canvas.style.border = "1px solid"; this.canvas.id = canvasID; // or use name this.canvas.addEventListener('click', click.bind(this)) //Limpa o canvas a cada frame. this.upC = function() { this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); } //cria um retangulo (preguiça de escrever). this.rect = function(x, y, w, h) { this.context.fillRect(x, y, w, h); } this.rectNav = this.canvas.getBoundingClientRect() } // construtor de botoes function Botao(x, y, w, h, canvas, callback, color) { this.x = x; this.y = y; this.w = w; this.h = h; this.cb = callback; this.color = color; this.render = function() { canvas.context.fillStyle = color || '#000'; canvas.rect(this.x, this.y, this.w, this.h); } this.ontarget = function(pos) { if (pos.x > this.x && pos.x < (this.x + this.w) && pos.y > this.y && pos.y < (this.y + this.h)) { this.cb(); }; } } var teste = new Canvas(400, 300, 'minhaID', 0); var bt1 = new Botao(100, 100, 100, 100, teste, function() { console.log("teste"); }); function run() { teste.upC(); bt1.render(); // renderiza o botao. window.requestAnimationFrame(run); } run(); function click(evt) { var rectNav = this.rectNav;; //obtêm as coordenadas do mouse na janela do cliente. var pos = { x: evt.clientX - rectNav.left, y: evt.clientY - rectNav.top }; bt1.ontarget(pos); //detecta se o click foi no botão } //cEvent('click', click);
비교하기