html 绘制矩形轨迹,选中区域
网格4*4,每个网格中存在小网格为8*8
支持从左上角拖拽选中,以及右下角拖拽选中
导出的数据含义,从右下角8*8网格开始每列自上向下,从左到右,
对于4*4网格,如图一顺序
code
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="Generator" content="EditPlus®">
- <meta name="Author" content="">
- <meta name="Keywords" content="">
- <meta name="Description" content="">
- <title>Document</title>
- <style>
- .box1{
- width:380px;
- position: fixed;
- z-index:;
- border:1px solid #ccc;
- left:;
- right:;
- margin:% auto auto auto;
- background-color:#fff;
- padding:6px;
- }
- .closeBtn{
- float:right;
- margin-right:%;
- cursor: pointer;
- }
- .title{
- height: 20px;
- }
- p{
- padding:3px;
- border-top:1px solid #ccc;
- word-break:normal;
- white-space:pre-warp;
- word-wrap:break-word;
- }
- #active_box{
- border:1px solid black;
- width: 0px;
- height: 0px;
- position: absolute;
- z-index:-;
- }
- table{
- border-style: ridge;
- position: positive;
- opacity:0.75;
- display:inline;
- border-collapse:collapse;
- }
- table:hover{
- cursor:pointer;
- }
- td
- {
- border: 1px solid black;
- }
- #d{
- float:right;
- }
- #p{
- float:left;
- }
- #tablelist{
- opacity:;
- width:%;
- margin-left:%;
- }
- .white{
- background-color:#ffffff;
- }
- .yellow{
- background-color:#FFFF00;
- border-radius:%;
- }
- #ddiv{
- opacity:;
- z-index:-;
- }
- button:hover{
- cursor:pointer;
- }
- input:hover{
- cursor:pointer;
- }
- .control{
- text-align: center;
- text-decoration: none;
- background-color: #4CAF50; /* Green */
- border: none;
- color: white;
- border-radius: 2px;
- margin:%;
- }
- </style>
- <script>
- var is_down=;
- var down_id="";
- var up_id="";
- var startX, startY;
- var is_follow=;
- var isExist=null;
- // 鼠标移动
- function mousemove(e){
- if(is_down){
- // 更新 box 尺寸
- if(document.getElementById("active_box") !== null) {
- var ab = document.getElementById("active_box");
- if(e.pageX>startX){
- if(e.pageY>startY){
- ab.style.top = startY + 'px';
- ab.style.left = startX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }else if(e.pageY==startY){
- ab.style.top = startY + 'px';
- ab.style.left = startX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }else{
- ab.style.top = e.pageY + 'px';
- ab.style.left = startX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }
- }else if(e.pageX==startX){
- if(e.pageY>startY){
- ab.style.top = startY + 'px';
- ab.style.left = startX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }else if(e.pageY==startY){
- ab.style.top = startY + 'px';
- ab.style.left = startX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }else{
- ab.style.top = e.pageY + 'px';
- ab.style.left = startX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }
- }else{
- if(e.pageY>startY){
- ab.style.top = startY + 'px';
- ab.style.left = e.pageX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }else if(e.pageY==startY){
- ab.style.top = e.pageY + 'px';
- ab.style.left = e.pageX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }else{
- ab.style.top = e.pageY + 'px';
- ab.style.left = e.pageX + 'px';
- ab.style.width = Math.abs(e.pageX - startX) + 'px';
- ab.style.height = Math.abs(e.pageY - startY) + 'px';
- }
- }
- }
- }else{
- if(document.getElementById("active_box") !== null){
- var ab = document.getElementById("active_box");
- document.body.removeChild(ab);
- }
- }
- }
- function mouseDown(e,d)
- {
- down_id=e.id;
- startX = d.pageX;
- startY = d.pageY;
- // 在页面创建 box
- var active_box = document.createElement("div");
- active_box.id = "active_box";
- active_box.className = "box";
- document.body.appendChild(active_box);
- active_box.style.top = startY + 'px';
- active_box.style.left = startX + 'px';
- active_box = null;
- is_down=;
- }
- function mouseUp(e,d)
- {
- is_down=;
- if(document.getElementById("active_box") !== null){
- var ab = document.getElementById("active_box");
- document.body.removeChild(ab);
- }
- up_id=e.id;
- tname_up=up_id.split(",")[];
- tname_down=down_id.split(",")[];
- x_up=parseInt(up_id.split(",")[]);
- y_up=parseInt(up_id.split(",")[]);
- x_down=parseInt(down_id.split(",")[]);
- y_down=parseInt(down_id.split(",")[]);
- if(down_id==up_id){
- if(tname_up==tname_down&&tname_up=="p"){
- //console.log("p");
- if(e.className=="white"){
- a=document.getElementById("p,"+x_up+","+y_up);
- a.className = "yellow";
- if(is_follow){
- b=document.getElementById("d,"+x_down+","+y_down);
- b.className = "yellow";
- }
- }else{
- a=document.getElementById("p,"+x_up+","+y_up);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("d,"+x_down+","+y_down);
- b.className = "white";
- }
- }
- }else if(tname_up==tname_down&&tname_up=="d"){
- if(e.className=="white"){
- a=document.getElementById("d,"+x_up+","+y_up);
- a.className = "yellow";
- if(is_follow){
- b=document.getElementById("p,"+x_down+","+y_down);
- b.className = "yellow";
- }
- }else{
- a=document.getElementById("d,"+x_up+","+y_up);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("p,"+x_down+","+y_down);
- b.className = "white";
- }
- }
- }
- }else{
- if(y_up>y_down){
- if(x_up>=x_down){
- for(i=x_down;i<=x_up;i++){
- for(j=y_down;j<=y_up;j++){
- //console.log("p,"+i+","+j);
- if(tname_up==tname_down&&tname_up=="p"){
- a=document.getElementById("p,"+i+","+j);
- a.className = "yellow";
- if(is_follow){
- b=document.getElementById("d,"+i+","+j);
- b.className = "yellow";
- }
- }else if(tname_up==tname_down&&tname_up=="d"){
- a=document.getElementById("d,"+i+","+j);
- a.className = "yellow";
- if(is_follow){
- b=document.getElementById("p,"+i+","+j);
- b.className = "yellow";
- }
- }
- }
- }
- }else {
- for(i=x_up;i<=x_down;i++){
- for(j=y_down;j<=y_up;j++){
- //console.log(i+","+j);
- if(tname_up==tname_down&&tname_up=="p"){
- a=document.getElementById("p,"+i+","+j);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("d,"+i+","+j);
- b.className = "white";
- }
- }else if(tname_up==tname_down&&tname_up=="d"){
- a=document.getElementById("d,"+i+","+j);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("p,"+i+","+j);
- b.className = "white";
- }
- }
- }
- }
- }
- }else if(y_up==y_down){
- if(x_up>x_down){
- for(i=x_down;i<=x_up;i++){
- for(j=y_down;j<=y_up;j++){
- //console.log(i+","+j);
- if(tname_up==tname_down&&tname_up=="p"){
- a=document.getElementById("p,"+i+","+j);
- a.className = "yellow";
- if(is_follow){
- b=document.getElementById("d,"+i+","+j);
- b.className = "yellow";
- }
- }else if(tname_up==tname_down&&tname_up=="d"){
- a=document.getElementById("d,"+i+","+j);
- a.className = "yellow";
- if(is_follow){
- b=document.getElementById("p,"+i+","+j);
- b.className = "yellow";
- }
- }
- }
- }
- }else {
- for(i=x_up;i<=x_down;i++){
- for(j=y_down;j<=y_up;j++){
- //console.log(i+","+j);
- if(tname_up==tname_down&&tname_up=="p"){
- a=document.getElementById("p,"+i+","+j);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("d,"+i+","+j);
- b.className = "white";
- }
- }else if(tname_up==tname_down&&tname_up=="d"){
- a=document.getElementById("d,"+i+","+j);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("p,"+i+","+j);
- b.className = "white";
- }
- }
- }
- }
- }
- }else{
- if(x_up>=x_down){
- for(i=x_down;i<=x_up;i++){
- for(j=y_up;j<=y_down;j++){
- //console.log(i+","+j);
- if(tname_up==tname_down&&tname_up=="p"){
- a=document.getElementById("p,"+i+","+j);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("d,"+i+","+j);
- b.className = "white";
- }
- }else if(tname_up==tname_down&&tname_up=="d"){
- a=document.getElementById("d,"+i+","+j);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("p,"+i+","+j);
- b.className = "white";
- }
- }
- }
- }
- }else{
- for(i=x_up;i<=x_down;i++){
- for(j=y_up;j<=y_down;j++){
- //console.log(i+","+j);
- if(tname_up==tname_down&&tname_up=="p"){
- a=document.getElementById("p,"+i+","+j);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("d,"+i+","+j);
- b.className = "white";
- }
- }else if(tname_up==tname_down&&tname_up=="d"){
- a=document.getElementById("d,"+i+","+j);
- a.className = "white";
- if(is_follow){
- b=document.getElementById("p,"+i+","+j);
- b.className = "white";
- }
- }
- }
- }
- }
- }
- }
- }
- function load(){
- var follow_Obj = document.getElementById("follow");
- follow_Obj.checked = true;
- is_follow=;
- document.getElementById("EleIdr").style.display="none";
- }
- function change(obj){
- if (obj.checked == true){
- is_follow=;
- document.getElementById("EleIdr").style.display="none";
- }
- else{
- is_follow=;
- document.getElementById("EleIdr").style.display="inline";
- }
- }
- function emp(){
- for(i=;i<;i++){
- for(j=;j<;j++){
- //console.log(i+","+j);
- a=document.getElementById("p,"+i+","+j);
- b=document.getElementById("d,"+i+","+j);
- a.className = "white";
- b.className = "white";
- }
- }
- }
- function bin_to_hex(str) {
- let hex_array = [{key:,val:""},{key:,val:""},{key:,val:""},{key:,val:""},{key:,val:""},{key:,val:""},{key:,val:""},{key:,val:""},
- {key:,val:""},{key:,val:""},{key:'a',val:""},{key:'b',val:""},{key:'c',val:""},{key:'d',val:""},{key:'e',val:""},{key:'f',val:""}]
- let value = ''
- let list=[]
- //console.log(str)
- if(str.length%!==){
- let a = ""
- let b=a.substring(,-str.length%)
- str = b.concat(str)
- }
- //console.log(str)
- while (str.length > ) {
- list.push(str.substring(, ))
- str = str.substring();
- }
- list.push(str)
- //console.log(list)
- for(let i=;i<list.length;i++){
- for(let j=;j<hex_array.length;j++){
- if(list[i]==hex_array[j].val){
- value = value.concat(hex_array[j].key)
- break
- }
- }
- }
- //console.log(value)
- return value
- }
- function output(e){
- var isExist = document.getElementById('boxId');
- var arrayObj = new Array();
- var ll=;
- var pointcur=[,];
- if(e.id=="EleIdr"){
- for(i=;i<;i++){
- if(ll==){
- for(j=;j<;j++){
- for(n=pointcur[];n<pointcur[]+;n++){
- var arraytmp = new Array();
- for(m=pointcur[];m<pointcur[]+;m++){
- //console.log(m,n);
- d=document.getElementById('d,'+m+","+n);
- if(d.className =="white"){
- arraytmp.push();
- }else{
- arraytmp.push();
- }
- }
- hex=bin_to_hex(arraytmp.join(""));
- //console.log(hex);
- arrayObj.push("0x"+hex);
- }
- if(j!=){
- pointcur[]=pointcur[]-;
- }
- }
- ll=;
- pointcur[]=pointcur[]-;
- }else{
- for(j=;j<;j++){
- for(n=pointcur[];n<pointcur[]+;n++){
- var arraytmp = new Array();
- for(m=pointcur[];m<pointcur[]+;m++){
- //console.log(m,n);
- d=document.getElementById('d,'+m+","+n);
- if(d.className =="white"){
- arraytmp.push();
- }else{
- arraytmp.push();
- }
- }
- hex=bin_to_hex(arraytmp.join(""));
- arrayObj.push("0x"+hex);
- }
- if(j!=){
- pointcur[]=pointcur[]+;
- }
- }
- ll=;
- pointcur[]=pointcur[]-;
- }
- }
- }else{
- for(i=;i<;i++){
- if(ll==){
- for(j=;j<;j++){
- for(n=pointcur[];n<pointcur[]+;n++){
- var arraytmp = new Array();
- for(m=pointcur[];m<pointcur[]+;m++){
- //console.log(m,n);
- d=document.getElementById('p,'+m+","+n);
- if(d.className =="white"){
- arraytmp.push();
- }else{
- arraytmp.push();
- }
- }
- hex=bin_to_hex(arraytmp.join(""));
- arrayObj.push("0x"+hex);
- }
- if(j!=){
- pointcur[]=pointcur[]-;
- }
- }
- ll=;
- pointcur[]=pointcur[]-;
- }else{
- for(j=;j<;j++){
- for(n=pointcur[];n<pointcur[]+;n++){
- var arraytmp = new Array();
- for(m=pointcur[];m<pointcur[]+;m++){
- //console.log(m,n);
- d=document.getElementById('p,'+m+","+n);
- if(d.className =="white"){
- arraytmp.push();
- }else{
- arraytmp.push();
- }
- }
- hex=bin_to_hex(arraytmp.join(""));
- arrayObj.push("0x"+hex);
- }
- if(j!=){
- pointcur[]=pointcur[]+;
- }
- }
- ll=;
- pointcur[]=pointcur[]-;
- }
- }
- }
- //判断是否存在,防止重复添加
- if( undefined == isExist || null == isExist ){
- text="";
- for (i = ; i < arrayObj.length; i++) {
- text += arrayObj[i] + ",";
- if((i+)%==){
- text +="<br>";
- }
- }
- //生成一个div
- var boxDiv = document.createElement('div');
- boxDiv.className = 'box1'; //添加我们自定义的样式
- boxDiv.id = 'boxId'; //给这个DIV添加一个ID,便于删除
- boxDiv.innerHTML = "<div class='title'><span class='closeBtn' onclick='removeDiv()'>关闭</span></div><p>"+text+"</p>";
- document.body.appendChild(boxDiv);
- }
- }
- //移除DIV事件
- function removeDiv(){
- var boxDiv = document.getElementById('boxId');
- document.body.removeChild(boxDiv);
- }
- </script>
- </head>
- <body ondragstart = "return false;" onload="load()">
- <script>
- var winHeight=;
- var winWidth=;
- if(window.innerHeight){
- winHeight = window.innerHeight;
- }
- else if((document.body) && (document.body.clientHeight)){
- winHeight = document.body.clientHeight;
- }
- if(window.innerWidth){
- winWidth = window.innerWidth;
- }
- else if((document.body) && (document.body.clientWidth)){
- winWidth = document.body.clientWidth;
- }
- th_width=Math.ceil(0.45*(winHeight-)/);
- document.write("<div id='tablelist'"+">")
- document.write("<table id ='p'"+" onmousemove='mousemove(event)'"+">")
- for (i = ; i <; i++){
- document.write("<tr class='p,"+i+"'>")
- for(j=;j<;j++){
- document.write("<td id='p,"+i+","+j+"' "+"width="+th_width+" "+"height="+th_width+" class='white'"+" onmousedown='mouseDown(this,event)'"+" onmouseup='mouseUp(this,event)'"+"></td>")
- }
- document.write("</tr>")
- }
- for (i = ; i <; i++){
- for (j = ; j <; j++){
- if(i==){
- document.getElementById('p,'+i+","+j).style.borderBottom="1.2px solid #FF00FF";
- }else if(j==){
- document.getElementById('p,'+i+","+j).style.borderRight="1.2px solid #FF00FF";
- }else if(i==){
- document.getElementById('p,'+i+","+j).style.borderBottom="1.51px solid #FF00FF";
- }else if(j==){
- document.getElementById('p,'+i+","+j).style.borderRight="1.51px solid #FF00FF";
- }else if(j==){
- document.getElementById('p,'+i+","+j).style.borderRight="1.2px solid #FF00FF";
- }else if(i==){
- document.getElementById('p,'+i+","+j).style.borderBottom="1.2px solid #FF00FF";
- }
- }
- }
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('p,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- document.write("</table>")
- document.write("<table id ='d'"+" onmousemove='mousemove(event)'"+">")
- for (i = ; i <; i++){
- document.write("<tr class='d,"+i+"'>")
- for(j=;j<;j++){
- document.write("<td id='d,"+i+","+j+"' "+"width="+th_width+" "+"height="+th_width+" class='white'"+" onmousedown='mouseDown(this,event)'"+" onmouseup='mouseUp(this,event)'"+"></td>")
- }
- document.write("</tr>")
- }
- for (i = ; i <; i++){
- for (j = ; j <; j++){
- if(i==){
- document.getElementById('d,'+i+","+j).style.borderBottom="1.2px solid #FF00FF";
- }else if(j==){
- document.getElementById('d,'+i+","+j).style.borderRight="1.2px solid #FF00FF";
- }else if(i==){
- document.getElementById('d,'+i+","+j).style.borderBottom="1.51px solid #FF00FF";
- }else if(j==){
- document.getElementById('d,'+i+","+j).style.borderRight="1.51px solid #FF00FF";
- }else if(j==){
- document.getElementById('d,'+i+","+j).style.borderRight="1.2px solid #FF00FF";
- }else if(i==){
- document.getElementById('d,'+i+","+j).style.borderBottom="1.2px solid #FF00FF";
- }
- }
- }
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- x=document.getElementById('d,'++","+);
- x.style.cssText="border-right:1.2px solid #FF00FF;border-bottom:1.2px solid #FF00FF;";
- document.write("</table>")
- document.write("<input type='checkbox' id='follow' onclick='change(this)'/>follow")
- document.write("<button class='control' id='EleIdl' onclick='output(this)'>o_left</button>")
- document.write("<button class='control' id='EleIdr' onclick='output(this)'>o_right</button>")
- document.write("<button class='control' onclick='emp()'>clear</button>")
- document.write("</div>")
- </script>
- </body>
- </html>
html 绘制矩形轨迹,选中区域的更多相关文章
- opencv2 使用鼠标绘制矩形并截取和保存矩形区域图像
前言 好长时间没写博文了,今天偷偷懒写篇关于opencv2中鼠标响应操作的文章. 鼠标操作属于用户接口设计,以前一直使用Qt来做,但是如果只需要简单的鼠标,键盘操作,直接调用opencv库的函数也未尝 ...
- 在OpenCV中利用鼠标绘制矩形和截取图像的矩形区域
这是两个相关的程序,前者是后者的基础.实际上前一个程序也是在前面博文的基础上做的修改,请参考<在OpenCV中利用鼠标绘制直线> .下面贴出代码. 程序之一,在OpenCV中利用鼠标绘制矩 ...
- Skyline实现橡皮筋效果绘制矩形框
这种类似于框选的效果用的比较普遍,一般三维平台和GIS平台都提供了支持接口,可是Skyline就是这么傲娇! 思路是这样的:绘制出的矩形框应该是一直与屏幕边框平行的,也就是矩形框的实际旋转角度是等于摄 ...
- vue cavnas绘制矩形,并解决由clearRec带来的闪屏问题
起因:在cavnas绘制矩形时 鼠标移动一直在监测中,所以鼠标移动的轨迹会留下一个个的矩形框, 要想清除矩形框官方给出了ctx.clearRect() 但是这样是把整个画布给清空了,因此需要不断 向画 ...
- 获取IMap上绘制的Element的区域范围
运行环境:开发环境:Windows7旗舰版64bit.VisualStudio2008 With SP1.ArcEngine10.0.NetFrameWork4.0.IIS7和C#开发语言. 问题描述 ...
- Python学习(一) —— matplotlib绘制三维轨迹图
在研究SLAM时常常需要对其输出的位姿进行复现以检测算法效果,在ubuntu系统中使用Python可以很好的完成相关的工作. 一. Ubuntu下Python的使用 在Ubuntu下使用Python有 ...
- canvas学习总结六:绘制矩形
在第三章中(canvas学习总结三:绘制路径-线段)我们提高Canvas绘图环境中有些属于立即绘制图形方法,有些绘图方法是基于路径的. 立即绘制图形方法仅有两个strokeRect(),fillRec ...
- Javascript高级编程学习笔记(86)—— Canvas(3)绘制矩形
绘制矩形 矩形是唯一一种可以直接在2D上下文中绘制的形状. 与矩形有关的方法包括: fillRect() strokeRect() clearRect() 上述方法都接收四个参数: 绘制矩形的 X 坐 ...
- canvas绘制矩形
canvas绘制矩形 方法 fillRect(x, y, width, height) 画一个实心的矩形 clearRect(x, y, width, height) 清除一块儿矩形区域 stroke ...
随机推荐
- [LeetCode] 181. Employees Earning More Than Their Managers_Easy tag: SQL
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- ShuffleElements(随机打乱数组中的元素)
给定一个数组,随机打乱数组中的元素,题意很简单直接上代码: package Array; import java.util.Arrays; import java.util.Collections; ...
- #C++初学记录(算法2)
A - Game 23 Polycarp plays "Game 23". Initially he has a number n and his goal is to trans ...
- html5<embed>的完整属性
问题起因:网页中插入Flash,看了代码,然后呢,小小的学习下 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000& ...
- Object-C-复制
copy 减少对象上下文依赖 copy 创建一个新对象,copy得到的副本对象与原来内容相同,新的对象retain为1,与旧有对象的引用计数无关,旧有对象没有变化 使用 copy 创建出来的对象是不可 ...
- click 在网页测试手机模式下无效,不能执行。调成非手机模式即可
click 在网页测试手机模式下无效,不能执行. 调成非手机模式即可
- ThinkPHP CURD mysql操作
ThinkPHP CURD操作 ThinkPHP提供了灵活和方便的数据操作方法,对数据库操作的四个基本操作(CURD):创建.更新.读取和删除的实现是最基本的,也是必须掌握的,在这基础之上才能熟悉更多 ...
- Redis 如何保持和MySQL数据一致【一】
1. MySQL持久化数据,Redis只读数据redis在启动之后,从数据库加载数据.读请求:不要求强一致性的读请求,走redis,要求强一致性的直接从mysql读取写请求:数据首先都写到数据库,之后 ...
- PHP实现多进程并行操作,可做守护进程(转,备用)
<?php /** * 入口函数 * 将此文件保存为 ProcessOpera.php * 在terminal中运行 /usr/local/php/bin/php ProcessOpera.ph ...
- Django框架之跨站请求伪造
跨站请求伪造(英语:Cross-site request forgery),也被称为one-click attack或者session riding,通常缩写为CSRF或者XSRF, 是一种挟制用户在 ...