第5篇白板之图片旋转标记做成箭头(一)

关键词:找到图片旋转代码, 找红点代码

一、图片旋转标记做成箭头

1.1现在图片旋转标记是“点”,需求是做成箭头,便于识别,现状如下:

1.2 找到图片旋转代码

   在widget.min.js中找到如下:

  1鼠标抬起时,一次旋转90度。

                          mouseup:function() {

                                   varg = this.global;

                                   "clockwise-rotation"=== g.pointsToMove && this.rotation(90),

                                   "counter-clockwise-rotation"=== g.pointsToMove && this.rotation(-90),

                                   is.isDragLastPath&& (tempContext.clearRect(0, 0, canvas_width, innerHeight),context.clearRect(0, 0, canvas_width, innerHeight), this.end()), g.ismousedown= !1

                          },

2 旋转角度函数如下:

                          rotation: function(angle){

                               if(points.length){

                                  var p = points[points.length - 1],

                                                     point= p[1];

                                                     point[6]? point[6] = (point[6]+angle)%360 : point[6] = angle;

                                                     if(point[6]%360== 0){

                                                         delete point[6];

                                                     }

                                       drawHelper.redraw(is.isDragLastPath);

                                       this.init();

                               }

                          },

注:旋转的代码如上,经验证是对的,打的标记也能跟踪,如下:

接下来要找那6个红点是在哪里做的。

1.3 找红点代码

1) 红点如下:

注:发现有两套图片旋转代码,不知哪一套作用的,全删除了,也没影响。重启下电脑试试。

每次要重启nodejs或更换房间号,这样,才能生效,经测试,起作用的代码为:widget.min.js

if("image" === p[0]){

                                           var num = 0;

                        if(point[6]&&(point[6]%180 != 0)){

                            num = 6;

                        }

                                           if(dHelper.isPointInPath(x, y,point[1+num]+point[3+num], point[2+num]+point[4+num]/2)){

                                               g.pointsToMove ="clockwise-rotation";

                                           }

                                           if(dHelper.isPointInPath(x, y,point[1+num], point[2+num]+point[4+num]/2)){

                                               g.pointsToMove ="counter-clockwise-rotation";

                                           }

                                           if (dHelper.isPointInPath(x, y,point[1+num], point[2+num])) {

                            g.pointsToMove = 'stretch-first';

                        }

                        if(dHelper.isPointInPath(x, y, point[1+num] + point[3+num], point[2+num])) {

                            g.pointsToMove ='stretch-second';

                        }

                        if(dHelper.isPointInPath(x, y, point[1+num], point[2+num] + point[4+num])) {

                            g.pointsToMove ='stretch-third';

                        }

                        if(dHelper.isPointInPath(x, y, point[1+num] + point[3+num], point[2+num] +point[4+num])) {

                            g.pointsToMove ='stretch-last';

                        }

                                       }

注:每次换个房间号,刷新一下就成。(不用强制刷新ctrl+F5)

2) 红点代码如下:

drawHelper.redraw(is.isDragLastPath),

g.ismousedown && this.dragShape(x,y),

 is.isDragLastPath && this.init()

准确来说,是上面三句中的最后一句,如下:

is.isDragLastPath && this.init(),去掉这一句,图像变为:

注:不再有红点。

2016年11月18日星期五

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值