File tree 4 files changed +40
-0
lines changed
4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 33
33
< script src ="./lib/drawingLine.js "> </ script >
34
34
< script src ="./lib/drawingPath.js "> </ script >
35
35
< script src ="./lib/drawingText.js "> </ script >
36
+ < script src ="./lib/tip.js "> </ script >
36
37
< script src ="./lib/upload.js "> </ script >
37
38
< script src ="./lib/copyPaste.js "> </ script >
38
39
Original file line number Diff line number Diff line change 54
54
o . selectable = false
55
55
o . evented = false
56
56
} ) ;
57
+ this . updateTip ( 'Tip: click to place points, press and pull for curves! Click outside or press Esc to cancel!' ) ;
57
58
break ;
58
59
case 'textbox' :
59
60
this . canvas . isDrawingTextMode = true
68
69
this . openDragDropPanel ( ) ;
69
70
break ;
70
71
default :
72
+ this . updateTip ( 'Tip: hold Shift when drawing a line for 15° angle jumps!' ) ;
71
73
break ;
72
74
}
73
75
}
155
157
this . initializeTextBoxDrawing ( this . canvas ) ;
156
158
this . initializeUpload ( this . canvas ) ;
157
159
this . initializeCopyPaste ( this . canvas ) ;
160
+ this . initializeTipSection ( ) ;
158
161
159
162
this . initializeZoomEvents ( ) ;
160
163
Original file line number Diff line number Diff line change @@ -354,4 +354,12 @@ body {
354
354
355
355
.drag-drop-input .dragging {
356
356
border-color : # 4368a9 ;
357
+ }
358
+
359
+ # tip-container {
360
+ padding : 10px ;
361
+ text-align : center;
362
+ touch-action : none;
363
+ cursor : default;
364
+ color : # 888 ;
357
365
}
Original file line number Diff line number Diff line change
1
+ ( function ( ) {
2
+ 'use strict' ;
3
+
4
+ function tipPanel ( ) {
5
+ const defaultTips = [
6
+ 'Tip: use arrows to move a selected object by 1 pixel!' ,
7
+ 'Tip: Shift + Click to select and modify multiple objects!' ,
8
+ 'Tip: hold Shift when rotating an object for 15° angle jumps!' ,
9
+ 'Tip: hold Shift when drawing a line for 15° angle jumps!' ,
10
+ ]
11
+ const _self = this ;
12
+ $ ( `${ this . containerSelector } .canvas-holder .content` ) . append ( `
13
+ <div id="tip-container">${ defaultTips [ parseInt ( Math . random ( ) * defaultTips . length ) ] } </div>` )
14
+ this . hideTip = function ( ) {
15
+ $ ( `${ _self . containerSelector } .canvas-holder .content #tip-container` ) . hide ( ) ;
16
+ }
17
+
18
+ this . showTip = function ( ) {
19
+ $ ( `${ _self . containerSelector } .canvas-holder .content #tip-container` ) . show ( ) ;
20
+ }
21
+
22
+ this . updateTip = function ( str ) {
23
+ typeof str === 'string' && $ ( `${ _self . containerSelector } .canvas-holder .content #tip-container` ) . html ( str ) ;
24
+ }
25
+ }
26
+
27
+ window . ImageEditor . prototype . initializeTipSection = tipPanel ;
28
+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments