File size: 8,290 Bytes
c2ea21f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
$(function () {
    let startPoint = [0,0];

    let generate = false;
    var roomSelect = 0;
    var mouseDown = false;
    var createLinew = false;
/*
    var leftsvg = document.getElementById('LeftGraphSVG');
    leftsvg.oncontextmenu = function() {
        return false;
    }

    $('#LeftGraphSVG').on('mousedown',function(e){

        let selectX = e.clientX - leftsvg.getBoundingClientRect().left;
        let selectY = e.clientY - leftsvg.getBoundingClientRect().top;

        var arr,reg=new RegExp("(^| )ifSelectRoom=([^;]*)(;|$)");
        if(arr=document.cookie.match(reg)){
            roomSelect = arr[2];
        }
        else{
            roomSelect = 0;
        }

        if(!generate && roomSelect == 1){
            //绘制点
            clearHighLight();

            var curRoom = "NULL";
            var curIndex = -1;

            arr,reg=new RegExp("(^| )RoomType=([^;]*)(;|$)");

            if(arr=document.cookie.match(reg)){
                curRoom = arr[2];
            }

            arr,reg=new RegExp("(^| )CurNum=([^;]*)(;|$)");

            if(arr=document.cookie.match(reg)){
                curIndex = arr[2];
            }
            var curPoints = d3.select("body").select("#LeftGraphSVG").selectAll("circle");

            var point = d3.select("body").select("#LeftGraphSVG").append("circle").attr("fill",roomcolor(curRoom)).attr("r",5)
                .attr("stroke","#000000").attr("stroke-width",2).attr("id","TransCircle"+curIndex+"_"+curRoom).on("mousedown",circle_mousedown)
                .on("mousemove",circle_mousemove).on("mouseup",circle_mouseup)
				.attr("cx",selectX/2).attr("cy",selectY/2).attr("class","TransCircle").append("title")//此处加入title标签
            .text(curRoom);


            roomSelect = false;
            document.cookie = "ifSelectRoom=0";
        }
    })*/

    $('#RightSVG').on('mousedown',function(e){
        console.log("Right!");
    })

    function clearHighLight(){
        var points = d3.select("body").select("#LeftGraphSVG").selectAll("circle").attr("stroke-width",0);
    }

    function circle_mousedown(){
        mouseDown = true;
        var points = d3.select("body").select("#LeftGraphSVG").selectAll("circle").attr("stroke-width",0);
        var selectPoint = d3.select("body").select("#LeftGraphSVG").select("#"+this.id).attr("stroke-width",2);

        if(d3.event.button == 2){
            selectPoint.remove();
            mouseDown = false;

            var id = this.id.split("_")[1];

            var checkBtns = d3.select("body").selectAll(".checkButton");

            checkBtns.each(function(d,i){
                var btn_id = this.id.split("_")[1];
                if(id == btn_id){
                    var checkElement = this.parentElement.parentElement;
                    var todoList = document.getElementById('todo');
                    checkElement.classList.remove('checked');
                    deleteAnimation(checkElement);
                    todoList.insertBefore(checkElement, todoList.firstChild);
                }
            })
        }
    }

    function circle_mousemove(){
        if(mouseDown){
            let newX = d3.event.x - leftsvg.getBoundingClientRect().left;
            let newY = d3.event.y - leftsvg.getBoundingClientRect().top;
            var selectPoint = d3.select("body").select("#LeftGraphSVG").select("#"+this.id)
                .attr("cx",newX/2).attr("cy",newY/2);
        }
    }

    function circle_mouseup(){
        mouseDown = false;
    }

    function deleteAnimation(deleteItem) {
        /* LEFT SIDE */
        const swirlR1 = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '0%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -100},
            radius: 30,
            swirlSize: 5,
            swirlFrequency: 1,
            duration: 500,
            direction: -1,
            degreeShift: 90
        });
        const swirlR2 = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '0%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -85},
            radius: 25,
            swirlSize: 5,
            swirlFrequency: 1,
            duration: 500,
            direction: -1,
            degreeShift: 70
        });
        const swirlR3 = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '0%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -70},
            radius: 20,
            swirlSize: 5,
            swirlFrequency: 1,
            duration: 1000,
            direction: -1,
            degreeShift: 50
        });

        const swirlL1 = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '0%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -100},
            radius: 30,
            swirlSize: 30,
            swirlFrequency: 1,
            duration: 1000,
            direction: -1,
            degreeShift: -90
        });
        const swirlL2 = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '0%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -85},
            radius: 30,
            swirlSize: 30,
            swirlFrequency: 1,
            duration: 500,
            direction: -1,
            degreeShift: -10
        });
        const swirlL3 = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '0%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -70},
            radius: 30,
            swirlSize: 30,
            swirlFrequency: 1,
            duration: 500,
            direction: -1,
            degreeShift: -30
        });


        /* RIGHT SIDE */
        const swirlR1B = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '100%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -100},
            radius: 30,
            swirlSize: 5,
            swirlFrequency: 1,
            duration: 500,
            direction: -1,
            degreeShift: -90
        });
        const swirlR2B = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '100%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -85},
            radius: 25,
            swirlSize: 5,
            swirlFrequency: 1,
            duration: 500,
            direction: -1,
            degreeShift: -70
        });
        const swirlR3B = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '100%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -70},
            radius: 20,
            swirlSize: 5,
            swirlFrequency: 1,
            duration: 1000,
            direction: -1,
            degreeShift: -50
        });

        const swirlL1B = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '100%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -100},
            radius: 30,
            swirlSize: 30,
            swirlFrequency: 1,
            duration: 1000,
            direction: -1,
            degreeShift: 90
        });
        const swirlL2B = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '100%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -85},
            radius: 30,
            swirlSize: 30,
            swirlFrequency: 1,
            duration: 500,
            direction: -1,
            degreeShift: 10
        });
        const swirlL3B = new mojs.ShapeSwirl({
            parent: deleteItem,
            top: '100%',
            left: '100%',
            fill: 'rgba(255,255,255,1)',
            y: {0: -70},
            radius: 30,
            swirlSize: 30,
            swirlFrequency: 1,
            duration: 500,
            direction: -1,
            degreeShift: 30
        });

        const timeline = new mojs.Timeline;

        timeline.add(swirlR1, swirlR2, swirlR3, swirlL1, swirlL2, swirlL3, swirlR1B, swirlR2B, swirlR3B, swirlL1B, swirlL2B, swirlL3B);

        timeline.play();
    }
})