-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenActionDialog
827 lines (745 loc) · 24.1 KB
/
OpenActionDialog
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
import $ from'jquery';
import {ProjectStructure} from'../project/ProjectStructure';
import {ApplicationSettings} from'../application/ApplicationSettings';
import {CommandManager} from '../command/CommandManager';
import Template from'./template/createaction/cmplist.tpl';
import {TemplateUtils} from '../utils/TemplateUtils';
import * as Commands from '../command/Commands';
let $dialog = $('#dialog-action');
let $cover = $('#dialog-cover');
let $close = $dialog.find('.dialog-close');
let $cancel = $('#dialog-new-action-cancel');
let $cmpList = $('#cmpList');
let $prev = $('#dialog-new-action-prev');
let $next = $('#dialog-new-action-next');
let $step = $('.step');
let isInitialized = false;
let $check = $('#actionCheck');
let checkValue = true;
let $fromInput = $('.step-transform.from input');
let status = null;
let $easingBtnLeft = $('#easingBtnLeft');
let $easingBtnRight = $('#easingBtnRight');
let $easingGroup = $('.easing-imgs-groups');
let easingPage = 0;
let $easingImage = $('.easing-img');
let cmpSelected = "false";
let updateAction = null;
export class OpenActionDialog {
/**
* Initialize the dialog.
*/
static init(params) {
status = params;
clear();
if (status == 'dialog-new-action') {
initCreateDialog();
}
else if (status == 'dialog-update-action') {
initUpdateDialog();
}
if (!isInitialized) {
bindEvents();
isInitialized = true;
}
}
/**
* Show the dialog.
*/
static show() {
$dialog.addClass('visible');
$cover.addClass('visible');
}
/**
*Close the dialog
*/
static close() {
$dialog.removeClass('visible');
$cover.removeClass('visible');
}
}
/**
* 清除之前对话框中的选中效果和输入框的值
*/
function clear() {
cmpSelected = null;
$cmpList.children().remove();
//from属性输入框只读
$fromInput.attr('readonly', 'true');
//将按钮文字设置为下一步
$next.html('下一步');
//提醒文字隐
$('.notice').removeClass('show');
//
$('#dialog-action input').val('');
$fromInput.attr('readonly', 'true');
$fromInput.addClass('readonly');
$check[0].checked = false;
//清除步骤效果
$('.step.step-now').removeClass('step-now');
let $stepOrder = $('.step-order');
for (let i = 1; i <= $stepOrder.length; i++) {
$stepOrder[i - 1].innerHTML = i;
}
$('.fa.fa-check.step-order-ok').attr('class', 'step-order');
}
/**
* bind dialog events
*/
function bindEvents() {
$close.click(OpenActionDialog.close);
$cancel.click(OpenActionDialog.close);
$next.click(toNext);
$prev.click(toPrev);
$check.click(readOnly);
$easingImage.click(selectEasingList);
$easingBtnLeft.click(easingMoveLeft);
$easingBtnRight.click(easingMoveRight);
$cmpList.on('click', '.cmp-name', selectTarget);
$cmpList.on('click', '.group-logo', groupToggle);
}
/**
* 对话框显示第几页
*
* @param index 页码 0-2
*/
function showPage(index) {
$step.eq(index).addClass('step-now');
}
/**
* 初始化输入模式新建action对话框
*/
function initCreateDialog() {
createDialogClear();
initCmpList();
showPage(0);
}
/**
* 将对话框所有样式还原,清除输入框的值
*/
function createDialogClear() {
$('.action-cmp-label').html('添加动作的组件 : 请务必选择组件,才可继续进行操作。');
//初始化摁建颜色
$next.addClass('refuse');
$prev.addClass('refuse');
// 有组件选中时
checkValue = true;
//创建新action状态下,设置easing默认值,还原easing列表位置
initEasingList(0, $('.easing-imgs-group.Sinusoidal .easing-img').eq(2));
easingPage = 0;
}
/**
* 初始化对话框组件列表
*/
function initCmpList() {
let scene = ProjectStructure.getScene();
createCmpList(scene, $cmpList, 0);
if (cmpSelected) {
function removeHidden(cmpSelected) {
let cmpParent = cmpSelected.parent();
let cmpChild = cmpParent.children('.cmp-name');
cmpParent.children('.hidden').removeClass('hidden');
cmpChild.children('.fa-caret-right').addClass('fa-caret-down');
cmpChild.children('.fa-caret-right').removeClass('fa-caret-right');
cmpChild.children('.cmpType').addClass('fa-folder-open');
cmpChild.children('.cmpType').removeClass('fa-folder');
if (cmpParent.attr('class') === 'cmp hidden') {
removeHidden(cmpParent);
}
}
removeHidden(cmpSelected);
}
}
/**
*
* @param scene 场景组件数据
* @param dom 根节点
* @param level 列表层级关系
*/
function createCmpList(scene, dom, level) {
scene.children.forEach(function (component) {
if (component.class !== "PerspectiveCamera") {
let $div = $(template(component));
let $typeIcon = $div.find('.cmpType');
addCmpTypeIcon($typeIcon, component);
if (level > 0) {
$div.addClass('hidden');
}
let $groupLogo = $div.find('.group-logo');
$groupLogo.css('margin-left', level * 25 + 'px');
let id = $div.find('.cmp-name').attr('data-id');
if (ApplicationSettings.getSelectedObjects() == id) {
$div.find('.cmp-name').addClass('cmp-active');
initPageData(component.uuid);
cmpSelected = $div;
let cmpName = component.name ? component.name : component.uuid;
$('.action-cmp-label').html('添加动作的组件 : ' + cmpName);
}
if (component.children && component.children.length > 0) {
$groupLogo.addClass('fa-caret-right');
$groupLogo.removeClass('un-visible');
createCmpList(component, $div, level + 1);
}
dom.append($div);
}
});
}
function addCmpTypeIcon($typeIcon, cmp) {
switch (cmp.class) {
case 'Object':
$typeIcon.addClass('fa-folder');
break;
case 'Mesh':
let geometry = ProjectStructure.getGeometry(cmp.geometry);
switch (geometry.class) {
case 'BoxBufferGeometry':
$typeIcon.addClass('fa-cube');
break;
case 'PlaneBufferGeometry':
$typeIcon.addClass('fa-square');
break;
default :
let msg = '[CmpLIstPanel][addCmpTypeIcon] The Mesh component type is undefined.';
throw new Error(msg);
}
break;
case 'Topic':
break;
default:
let msg = '[CmpLIstPanel][addCmpTypeIcon] The component type is undefined.';
throw new Error(msg);
}
}
/**
* 修改action初始化
*/
function initUpdateDialog() {
let component = null;
let name = '';
updateAction = ProjectStructure.getAction(ApplicationSettings.getSelectedCommand(),
ApplicationSettings.getSelectedAction());
if (updateAction.target == 'camera') {
component = ProjectStructure.getCamera();
component.name = 'camera';
component.uuid = 'camera';
name = 'camera';
} else {
component = ProjectStructure.getObject(updateAction.target);
name = component.name;
}
updateDialogClear();
$('.action-cmp-label').html('添加动作的组件 : ' + name);
updateCmplist($cmpList, component);
showPage(1);
}
/**
* 修改action初始化dialog样式
*/
function updateDialogClear() {
//初始化摁建颜色
$next.removeClass('refuse');
$prev.removeClass('refuse');
// 第一页页签效果
$('.step-order').eq(0).addClass("fa fa-check step-order-ok");
$('.step-order').eq(0).html('');
$('.easing-img').each(function () {
if ($(this).attr('alt') === updateAction.easing) {
let page = $(this).parent().index();
initEasingList(page, $(this));
}
});
}
/**
*
*
* @param dom 根节点
* @param actionCmp 修改action的组件.
*/
function updateCmplist(dom, actionCmp) {
let $div = $(template(actionCmp));
$div.find('.cmp-name').addClass('cmp-active');
dom.append($div);
initPageData(actionCmp.uuid);
}
/**
* 组件箭头点击事件,把其子集显示或隐藏.
*/
function groupToggle(event) {
event.stopPropagation();
if (status === 'dialog-new-action') {
let toggleTriangle = $(this);
let foldIcon = toggleTriangle.parent().find('.cmpType');
let childCmp = toggleTriangle.parent().parent().children('.cmp');
if (toggleTriangle.attr('class') === 'group-logo fa fa-caret-right') {
foldIcon.removeClass('fa-folder');
foldIcon.addClass('fa-folder-open');
childCmp.removeClass('hidden');
toggleTriangle.removeClass('fa-caret-right');
toggleTriangle.addClass('fa-caret-down')
} else if (toggleTriangle.attr('class') === 'group-logo fa fa-caret-down') {
foldIcon.addClass('fa-folder');
foldIcon.removeClass('fa-folder-open');
childCmp.addClass('hidden');
toggleTriangle.addClass('fa-caret-right');
toggleTriangle.removeClass('fa-caret-down')
}
}
}
/**
*组件列表中组件被选中时,修改样式.并初始化dialog输入框数据.
*/
function selectTarget() {
if (status === 'dialog-new-action') {
$('.cmp-active').removeClass('cmp-active');
$(this).addClass('cmp-active');
initPageData($(this).attr('data-id'));
let name = $('.cmp-active').text();
$('.action-cmp-label').html('添加动作的组件 : ' + name);
}
}
/**
* 1.初始化dialog模板数据,2.根据组件id对应的数据更改模板数据,3.将模板数据组装.
*
* @param id 选中组件的uuid
*/
function initPageData(id) {
$next.removeClass('refuse');
let actionTemplateData = {
from : {
position: {
x: 0,
y: 0,
z: 0
},
rotation: {
x: 0,
y: 0,
z: 0
},
scale : {
x: 1,
y: 1,
z: 1
},
opacity : 1
},
to : {
position: {
x: 0,
y: 0,
z: 0
},
rotation: {
x: 0,
y: 0,
z: 0
},
scale : {
x: 1,
y: 1,
z: 1
},
opacity : 1
},
delay : 0,
duration: 1000,
easing : 'Sinusoidal.InOut',
inherit : checkValue
};
addPageData(actionTemplateData, id);
pageDataFactory(actionTemplateData);
}
/**
* 根据组件之前action数据或场景数据,更改模板数据。
*
* @param templateData 模板数据
* @param id 组件uuid
*/
function addPageData(templateData, id) {
let selectedAction = ApplicationSettings.getSelectedAction();
let selectedCommand = ApplicationSettings.getSelectedCommand();
let commands = ProjectStructure.getCommands();
let prevAction = findPreAction(commands, selectedCommand, selectedAction, id);
if (prevAction) {
if (prevAction.to.position) {
templateData.to.position = prevAction.to.position;
}
if (prevAction.to.rotation) {
templateData.to.rotation = prevAction.to.rotation;
}
if (prevAction.to.scale) {
templateData.to.scale = prevAction.to.scale;
}
if (prevAction.from.position) {
templateData.from.position = prevAction.from.position;
}
if (prevAction.from.rotation) {
templateData.from.rotation = prevAction.from.rotation;
}
if (prevAction.from.scale) {
templateData.from.scale = prevAction.from.scale;
}
if (prevAction.delay) {
templateData.delay = prevAction.delay;
}
if (prevAction.duration) {
templateData.duration = prevAction.duration;
}
if (prevAction.easing) {
templateData.easing = prevAction.easing;
}
} else {
let sceneTarget = ProjectStructure.getObject(id);
templateData.to.position = sceneTarget.position;
templateData.to.rotation = sceneTarget.rotation;
templateData.to.scale = sceneTarget.scale;
}
}
/**
* 根据模板数据组装dialog输入框的值,创建新action时from和to公用一个值。
*
* @param templateData 模板数据
*/
function pageDataFactory(templateData) {
if (status === 'dialog-new-action') {
$('#fromPositionX,#toPositionX').val(templateData.to.position.x);
$('#fromPositionY,#toPositionY').val(templateData.to.position.y);
$('#fromPositionZ,#toPositionZ').val(templateData.to.position.z);
$('#fromRotationX,#toRotationX').val(templateData.to.rotation.x);
$('#fromRotationY,#toRotationY').val(templateData.to.rotation.y);
$('#fromRotationZ,#toRotationZ').val(templateData.to.rotation.z);
$('#fromScaleX,#toScaleX').val(templateData.to.scale.x);
$('#fromScaleY,#toScaleY').val(templateData.to.scale.y);
$('#fromScaleZ,#toScaleZ').val(templateData.to.scale.z);
$('#fromOpacity,#toOpacity').val(templateData.to.opacity);
$('#actionDuration').val(1000);
$('#actionDelay').val(0);
} else if (status === 'dialog-update-action') {
$('#fromPositionX').val(templateData.from.position.x);
$('#fromPositionY').val(templateData.from.position.y);
$('#fromPositionZ').val(templateData.from.position.z);
$('#fromRotationX').val(templateData.from.rotation.x);
$('#fromRotationY').val(templateData.from.rotation.y);
$('#fromRotationZ').val(templateData.from.rotation.z);
$('#fromScaleX').val(templateData.from.scale.x);
$('#fromScaleY').val(templateData.from.scale.y);
$('#fromScaleZ').val(templateData.from.scale.z);
$('#fromOpacity').val(templateData.from.opacity);
$('#toPositionX').val(templateData.to.position.x);
$('#toPositionY').val(templateData.to.position.y);
$('#toPositionZ').val(templateData.to.position.z);
$('#toRotationX').val(templateData.to.rotation.x);
$('#toRotationY').val(templateData.to.rotation.y);
$('#toRotationZ').val(templateData.to.rotation.z);
$('#toScaleX').val(templateData.to.scale.x);
$('#toScaleY').val(templateData.to.scale.y);
$('#toScaleZ').val(templateData.to.scale.z);
$('#toOpacity').val(templateData.to.opacity);
$('#actionDuration').val(templateData.duration);
$('#actionDelay').val(templateData.delay);
}
}
/**
* 查找组件之前是否存在action数据
*
* @param commands 所有command数据
* @param cmdIndex 选中的action所在command的位置
* @param actIndex 选中的action所在command的action位置
* @param cmpId 选中组件uuid
* @returns 返回新建的action之前同一个组件的最后一个action对象
*/
function findPreAction(commands, cmdIndex, actIndex, cmpId) {
let beforeAction = [];
for (let i = 0; i < cmdIndex + 1; i++) {
if (i == cmdIndex) {
for (let m = 0; m <= actIndex; m++) {
if (commands[i].actions[m].target == cmpId) {
beforeAction.push(commands[i].actions[m]);
}
}
} else {
commands[i].actions.forEach(function (child) {
if (child.target == cmpId) {
beforeAction.push(child);
}
});
}
}
return beforeAction[beforeAction.length - 1];
}
/**
* from属性输入框只读或可写状态切换
*/
function readOnly() {
if ($check[0].checked) {
checkValue = false;
$fromInput.removeAttr('readonly');
$fromInput.removeClass('readonly');
} else {
checkValue = true;
$fromInput.attr('readonly', 'true');
$fromInput.addClass('readonly');
}
}
/**
* easing列表选中事件
*/
function selectEasingList() {
$('.easing-img-active').removeClass('easing-img-active');
$(this).addClass('easing-img-active');
}
/**
*
* @returns 创建的action对象
*/
function createAction() {
let action = {
target : '',
from : {
position: {
x: 0,
y: 0,
z: 0
},
rotation: {
x: 0,
y: 0,
z: 0
},
scale : {
x: 1,
y: 1,
z: 1
},
opacity : 1
},
to : {
position: {
x: 0,
y: 0,
z: 0
},
rotation: {
x: 0,
y: 0,
z: 0
},
scale : {
x: 1,
y: 1,
z: 1
},
opacity : 1
},
delay : 0,
duration: 1000,
easing : 'Sinusoidal.InOut',
inherit : checkValue
};
action.target = $('.cmp-active').attr('data-id');
action.from.position.x = $('#fromPositionX').val();
action.from.position.y = $('#fromPositionY').val();
action.from.position.z = $('#fromPositionZ').val();
action.from.rotation.x = $('#fromRotationX').val();
action.from.rotation.y = $('#fromRotationY').val();
action.from.rotation.z = $('#fromRotationZ').val();
action.from.scale.x = $('#fromScaleX').val();
action.from.scale.y = $('#fromScaleY').val();
action.from.scale.z = $('#fromScaleZ').val();
action.from.opacity = $('#fromOpacity').val();
action.to.position.x = $('#toPositionX').val();
action.to.position.y = $('#toPositionY').val();
action.to.position.z = $('#toPositionZ').val();
action.to.rotation.x = $('#toRotationX').val();
action.to.rotation.y = $('#toRotationY').val();
action.to.rotation.z = $('#toRotationZ').val();
action.to.scale.x = $('#toScaleX').val();
action.to.scale.y = $('#toScaleY').val();
action.to.scale.z = $('#toScaleZ').val();
action.to.opacity = $('#toOpacity').val();
action.duration = $('#actionDuration').val();
action.delay = $('#actionDelay').val();
action.easing = $('.easing-img-active').attr('alt');
return action;
}
/**
* 对话框下一步按及完成按钮创建action
*/
function toNext() {
let nowStep = $('.step.step-now');
let nowOrder = $step.index(nowStep);
if (nowOrder < 2) {
if (nowOrder == 0) {
cmpListChecked(nowStep, nowOrder);
} else if (nowOrder == 1) {
valueChecked(nowStep, nowOrder);
}
}
else if (nowOrder == 2) {
toSubmit();
}
}
/**
* 检查组件列表是否有组件选中,选中才可进入下一步操作
*
* @param nowStep 当前步骤dom节点
* @param nowOrder 当前第几步 (0-2)
*/
function cmpListChecked(nowStep, nowOrder) {
let $cmpActive = $cmpList.find('.cmp-active');
if ($cmpActive.length != 0) {
$prev.removeClass('refuse');
nowStep.removeClass('step-now');
changeOrder("toNext", nowOrder);
document.getElementById('toPositionX').focus();
}
}
/**
* 检查透明度是否符合要求,符合才可进入下一步操作
*
* @param nowStep 当前步骤dom节点
* @param nowOrder 当前第几步 (0-2)
*/
function valueChecked(nowStep, nowOrder) {
let $opacity = $('.attribute-value.opacity');
let canNext = true;
for (let i = 0; i < $opacity.length; i++) {
if ($opacity.eq(i).val() < 0 || $opacity.eq(i).val() > 1) {
canNext = false;
$opacity.eq(i).parent().find('.opacity-notice').addClass('show');
}
}
if (canNext) {
$('.opacity-notice.show').removeClass('show');
$next.html('完成');
$next.addClass('submit');
nowStep.removeClass('step-now');
changeOrder("toNext", nowOrder);
}
}
/**
* 完成按钮额
*/
function toSubmit() {
let $timeInput = $('.step-effect .attribute-value');
let canSubmit = true;
for (let i = 0; i < $timeInput.length; i++) {
if ($timeInput.eq(i).val() < 0) {
canSubmit = false;
$timeInput.eq(i).parent().find('.time-notice').addClass('show');
}
}
if (canSubmit) {
$('.time-notice').removeClass('show');
if (status === 'dialog-new-action') {
let newAction = createAction();
CommandManager.execute(Commands.ANIME_EDIT_CREATE_ACTION, newAction);
} else if (status === 'dialog-update-action') {
let afterAction = createAction();
let params = {
id : updateAction.id,
after: afterAction
};
CommandManager.execute(Commands.ANIME_EDIT_ATTRIBUTE_CHANGE, params);
}
OpenActionDialog.close();
}
}
/**
*
* 对话框上一步
*/
function toPrev() {
let nowStep = $('.step.step-now');
let nowOrder = $step.index(nowStep);
if (nowOrder > 0) {
nowStep.removeClass('step-now');
changeOrder('toPrev', nowOrder);
// 如果当前在第三页,返回上一步时,将按钮内容完成改为下一步
if (nowOrder == 2) {
$next.html('下一步');
$next.removeClass('submit');
document.getElementById('toPositionX').focus();
}
if (nowOrder == 1) {
$prev.addClass('refuse');
}
}
}
/**
* 步骤切换,样式改变。
*
* @param nowOrder 当前步骤
*/
function changeOrder(direction, nowOrder) {
if (direction === "toNext") {
let stepOrder = $step[nowOrder].querySelector(".step-order");
stepOrder.innerHTML = " ";
$(stepOrder).addClass("fa fa-check step-order-ok");
$step.eq(nowOrder + 1).addClass('step-now');
} else {
let stepOrder = $step[nowOrder - 1].querySelector(".step-order");
stepOrder.innerHTML = nowOrder;
$(stepOrder).removeClass("fa fa-check step-order-ok");
$step.eq(nowOrder - 1).addClass('step-now');
}
}
/**
* easing列表向左移动
*/
function easingMoveLeft() {
if (easingPage < -1) {
easingPage++;
let left = ((easingPage) * 387) + "px";
$easingGroup.css('left', left);
$easingBtnLeft.removeClass('no-click');
$easingBtnRight.removeClass('no-click');
} else if (easingPage == -1) {
easingPage++;
let left = ((easingPage) * 387) + "px";
$easingGroup.css('left', left);
$easingBtnLeft.addClass('no-click');
}
}
/**
* easing列表向右移动
*/
function easingMoveRight() {
if (easingPage > -9) {
easingPage--;
let right = ((easingPage) * 387) + "px";
$easingGroup.css('left', right);
$easingBtnRight.removeClass('no-click');
$easingBtnLeft.removeClass('no-click');
} else if (easingPage == -9) {
easingPage--;
let right = ((easingPage) * 387) + "px";
$easingGroup.css('left', right);
$easingBtnRight.addClass('no-click');
}
}
/**
* 初始化easing图片
*
* @param page easing页码
* @param easing 默认选中的easing的dom节点
*/
function initEasingList(page, easing) {
$('.easing-img-active').removeClass('easing-img-active');
easingPage = -page;
easing.addClass('easing-img-active');
let pageleft = (-page * 387) + "px";
$easingGroup.css('left', pageleft);
$easingBtnLeft.removeClass('no-click');
$easingBtnRight.removeClass('no-click');
if (page === 0) {
$easingBtnLeft.addClass('no-click');
$easingBtnRight.removeClass('no-click');
} else if (page === 10) {
$easingBtnLeft.removeClass('no-click');
$easingBtnRight.addClass('no-click');
}
}
function template(model) {
return TemplateUtils.template(Template)(model);
}