Commit c3bee6bb30f09df67ade7eea0478afdc44c35a48
1 parent
60b61386b4
Exists in
master
and in
1 other branch
fix trash icon effection
Showing 2 changed files with 21 additions and 3 deletions Side-by-side Diff
app/index.html
app/scripts/controllers/tshirtdesign.js
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | }); |
11 | 11 | canvas.on({ |
12 | 12 | 'object:added' : onIllustrationAdded, |
13 | - 'object:moving' : onIllustrationChange, | |
13 | + 'object:moving' : onIllustrationMoving, | |
14 | 14 | 'object:scaling' : onIllustrationChange, |
15 | 15 | 'object:rotating' : onIllustrationChange, |
16 | 16 | 'object:selected' : onObjectSelected, |
17 | 17 | |
... | ... | @@ -50,8 +50,17 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | function onIllustrationModifield(options){ |
53 | + // | |
54 | + var pointer = canvas.getPointer(options.e); | |
55 | + if (pointer.x >= 567 && pointer.y >= 620 && pointer.x <= 600 && pointer.y <= 670){ | |
56 | + canvas.getActiveObject().remove(); | |
57 | + $('.design-content .trash-design').css({'opacity':'1'}); | |
58 | + return; | |
59 | + } | |
60 | + | |
61 | + // | |
53 | 62 | var objOffset = canvas.getActiveObject().getBoundingRect(); |
54 | - var cH = canvas.height, cW = canvas.width, H0 = 50, W0 = 50; | |
63 | + var cH = canvas.height, cW = canvas.width, H0 = 20, W0 = 20; | |
55 | 64 | //console.log(objOffset,canvas.height,canvas.width); |
56 | 65 | if (objOffset.left<W0-objOffset.width || objOffset.left>cW-W0 || objOffset.top<H0-objOffset.height || objOffset.top>cH-H0){ |
57 | 66 | if (confirm('削除してもよろしいですか')){ |
... | ... | @@ -89,6 +98,15 @@ |
89 | 98 | // if (obj === options.target) return; |
90 | 99 | // obj.setOpacity(options.target.intersectsWithObject(obj) ? 0.5 : 1); |
91 | 100 | // }); |
101 | + } | |
102 | + | |
103 | + function onIllustrationMoving(options) { | |
104 | + var pointer = canvas.getPointer(options.e); | |
105 | + if (pointer.x >= 567 && pointer.y >= 620 && pointer.x <= 600 && pointer.y <= 670){ | |
106 | + $('.design-content .trash-design').css({'opacity':'0.5'}); | |
107 | + }else{ | |
108 | + $('.design-content .trash-design').css({'opacity':'1'}); | |
109 | + } | |
92 | 110 | } |
93 | 111 | |
94 | 112 | function onObjectOut() { |