8
0
Просмотр исходного кода

Renamed default positions of BalloonPanelView.

Oskar Wróbel 8 лет назад
Родитель
Сommit
42a6f34787

+ 20 - 20
packages/ckeditor5-ui/src/panel/balloon/balloonpanelview.js

@@ -181,10 +181,10 @@ export default class BalloonPanelView extends View {
 		const positionOptions = Object.assign( {}, {
 			element: this.element,
 			positions: [
-				defaultPositions.se,
-				defaultPositions.sw,
-				defaultPositions.ne,
-				defaultPositions.nw
+				defaultPositions.southEastArrowNorthEast,
+				defaultPositions.southWestArrowNorthEast,
+				defaultPositions.northEastArrowSouthWest,
+				defaultPositions.northWestArrowSouthEast
 			],
 			limiter: defaultLimiterElement,
 			fitInViewport: true
@@ -334,7 +334,7 @@ BalloonPanelView.arrowVerticalOffset = 15;
  *
  * The available positioning functions are as follows:
  *
- * * South east:
+ * * South east arrow north west:
  *
  *		[ Target ]
  *		    ^
@@ -343,7 +343,7 @@ BalloonPanelView.arrowVerticalOffset = 15;
  *		+-----------------+
  *
  *
- * * South west:
+ * * South west arrow north east:
  *
  *		         [ Target ]
  *		              ^
@@ -352,7 +352,7 @@ BalloonPanelView.arrowVerticalOffset = 15;
  *		+-----------------+
  *
  *
- * * North east:
+ * * North east arrow south west:
  *
  *		+-----------------+
  *		|     Balloon     |
@@ -361,7 +361,7 @@ BalloonPanelView.arrowVerticalOffset = 15;
  *		[ Target ]
  *
  *
- * * North west:
+ * * North west arrow south east:
  *
  *		+-----------------+
  *		|     Balloon     |
@@ -370,7 +370,7 @@ BalloonPanelView.arrowVerticalOffset = 15;
  *		         [ Target ]
  *
  *
- * * Forward selection:
+ * * South east arrow north:
  *
  * 		[text range]
  * 		           ^
@@ -379,7 +379,7 @@ BalloonPanelView.arrowVerticalOffset = 15;
  * 		  +-----------------+
  *
  *
- * * Forward selection alternative:
+ * * North east arrow south:
  *
  * 		  +-----------------+
  * 		  |     Balloon     |
@@ -388,7 +388,7 @@ BalloonPanelView.arrowVerticalOffset = 15;
  * 		[text range]
  *
  *
- * * Backward selection:
+ * * North west arrow south:
  *
  * 		+-----------------+
  * 		|     Balloon     |
@@ -397,7 +397,7 @@ BalloonPanelView.arrowVerticalOffset = 15;
  * 		         [text range]
  *
  *
- * * Backward selection alternative:
+ * * South west arrow north:
  *
  * 		         [text range]
  * 		         ^
@@ -415,49 +415,49 @@ BalloonPanelView.arrowVerticalOffset = 15;
  * @member {Object} module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions
  */
 BalloonPanelView.defaultPositions = {
-	se: ( targetRect ) => ( {
+	southEastArrowNorthEast: ( targetRect ) => ( {
 		top: targetRect.bottom + BalloonPanelView.arrowVerticalOffset,
 		left: targetRect.left + targetRect.width / 2 - BalloonPanelView.arrowHorizontalOffset,
 		name: 'arrow_se'
 	} ),
 
-	sw: ( targetRect, balloonRect ) => ( {
+	southWestArrowNorthEast: ( targetRect, balloonRect ) => ( {
 		top: targetRect.bottom + BalloonPanelView.arrowVerticalOffset,
 		left: targetRect.left + targetRect.width / 2 - balloonRect.width + BalloonPanelView.arrowHorizontalOffset,
 		name: 'arrow_sw'
 	} ),
 
-	ne: ( targetRect, balloonRect ) => ( {
+	northEastArrowSouthWest: ( targetRect, balloonRect ) => ( {
 		top: targetRect.top - balloonRect.height - BalloonPanelView.arrowVerticalOffset,
 		left: targetRect.left + targetRect.width / 2 - BalloonPanelView.arrowHorizontalOffset,
 		name: 'arrow_ne'
 	} ),
 
-	nw: ( targetRect, balloonRect ) => ( {
+	northWestArrowSouthEast: ( targetRect, balloonRect ) => ( {
 		top: targetRect.top - balloonRect.height - BalloonPanelView.arrowVerticalOffset,
 		left: targetRect.left + targetRect.width / 2 - balloonRect.width + BalloonPanelView.arrowHorizontalOffset,
 		name: 'arrow_nw'
 	} ),
 
-	forwardSelection: ( targetRect, balloonRect ) => ( {
+	southEastArrowNorth: ( targetRect, balloonRect ) => ( {
 		top: targetRect.bottom + BalloonPanelView.arrowVerticalOffset,
 		left: targetRect.right - balloonRect.width / 2,
 		name: 'arrow_s'
 	} ),
 
-	forwardSelectionAlternative: ( targetRect, balloonRect ) => ( {
+	northEastArrowSouth: ( targetRect, balloonRect ) => ( {
 		top: targetRect.top - balloonRect.height - BalloonPanelView.arrowVerticalOffset,
 		left: targetRect.right - balloonRect.width / 2,
 		name: 'arrow_n'
 	} ),
 
-	backwardSelection: ( targetRect, balloonRect ) => ( {
+	northWestArrowSouth: ( targetRect, balloonRect ) => ( {
 		top: targetRect.top - balloonRect.height - BalloonPanelView.arrowVerticalOffset,
 		left: targetRect.left - balloonRect.width / 2,
 		name: 'arrow_n'
 	} ),
 
-	backwardSelectionAlternative: ( targetRect, balloonRect ) => ( {
+	southWestArrowNorth: ( targetRect, balloonRect ) => ( {
 		top: targetRect.bottom + BalloonPanelView.arrowVerticalOffset,
 		left: targetRect.left - balloonRect.width / 2,
 		name: 'arrow_s'

+ 20 - 20
packages/ckeditor5-ui/tests/panel/balloon/balloonpanelview.js

@@ -189,10 +189,10 @@ describe( 'BalloonPanelView', () => {
 				element: view.element,
 				target: target,
 				positions: [
-					BalloonPanelView.defaultPositions.se,
-					BalloonPanelView.defaultPositions.sw,
-					BalloonPanelView.defaultPositions.ne,
-					BalloonPanelView.defaultPositions.nw
+					BalloonPanelView.defaultPositions.southEastArrowNorthEast,
+					BalloonPanelView.defaultPositions.southWestArrowNorthEast,
+					BalloonPanelView.defaultPositions.northEastArrowSouthWest,
+					BalloonPanelView.defaultPositions.northWestArrowSouthEast
 				],
 				limiter: document.body,
 				fitInViewport: true
@@ -658,64 +658,64 @@ describe( 'BalloonPanelView', () => {
 			};
 		} );
 
-		it( 'se', () => {
-			expect( positions.se( targetRect ) ).to.deep.equal( {
+		it( 'southEastArrowNorthEast', () => {
+			expect( positions.southEastArrowNorthEast( targetRect ) ).to.deep.equal( {
 				top: 215,
 				left: 120,
 				name: 'arrow_se'
 			} );
 		} );
 
-		it( 'sw', () => {
-			expect( positions.sw( targetRect, balloonRect ) ).to.deep.equal( {
+		it( 'southWestArrowNorthEast', () => {
+			expect( positions.southWestArrowNorthEast( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 215,
 				left: 130,
 				name: 'arrow_sw'
 			} );
 		} );
 
-		it( 'ne', () => {
-			expect( positions.ne( targetRect, balloonRect ) ).to.deep.equal( {
+		it( 'northEastArrowSouthWest', () => {
+			expect( positions.northEastArrowSouthWest( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 35,
 				left: 120,
 				name: 'arrow_ne'
 			} );
 		} );
 
-		it( 'nw', () => {
-			expect( positions.nw( targetRect, balloonRect ) ).to.deep.equal( {
+		it( 'northWestArrowSouthEast', () => {
+			expect( positions.northWestArrowSouthEast( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 35,
 				left: 130,
 				name: 'arrow_nw'
 			} );
 		} );
 
-		it( 'forwardSelection', () => {
-			expect( positions.forwardSelection( targetRect, balloonRect ) ).to.deep.equal( {
+		it( 'southEastArrowNorth', () => {
+			expect( positions.southEastArrowNorth( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 215,
 				left: 175,
 				name: 'arrow_s'
 			} );
 		} );
 
-		it( 'forwardSelectionAlternative', () => {
-			expect( positions.forwardSelectionAlternative( targetRect, balloonRect ) ).to.deep.equal( {
+		it( 'northEastArrowSouth', () => {
+			expect( positions.northEastArrowSouth( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 35,
 				left: 175,
 				name: 'arrow_n'
 			} );
 		} );
 
-		it( 'backwardSelection', () => {
-			expect( positions.backwardSelection( targetRect, balloonRect ) ).to.deep.equal( {
+		it( 'northWestArrowSouth', () => {
+			expect( positions.northWestArrowSouth( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 35,
 				left: 75,
 				name: 'arrow_n'
 			} );
 		} );
 
-		it( 'backwardSelectionAlternative', () => {
-			expect( positions.backwardSelectionAlternative( targetRect, balloonRect ) ).to.deep.equal( {
+		it( 'southWestArrowNorth', () => {
+			expect( positions.southWestArrowNorth( targetRect, balloonRect ) ).to.deep.equal( {
 				top: 215,
 				left: 75,
 				name: 'arrow_s'