 			for direction in ["w", "s", "e", "n"]
 				CUI.DOM.removeClass(@__pointer, get_pointer_class(direction))
 
+
 		# measure all 4 directions for all pointers
 		dim_pointer = {}
 		for placement in ["n", "s", "e", "w"]
 
-			pointer_direction = {
-				n: "s"
-				s: "n"
-				e: "w"
-				w: "e"
-			}[placement]
+			pointer_direction = get_pointer_direction(placement)
 
 			if @__pointer
 				CUI.DOM.addClass(@__pointer, get_pointer_class(pointer_direction))


		dim_window = CUI.getViewport()

		get_pointer_class = (direction) =>
			if CUI.__ng__
				"cui-layer-pointer--"+direction
			else
				"cui-pointer-placement-"+pointer_direction

		if @__pointer
			# reset pointer

			vp.overlap_height = 0
			vp.overlap_width = 0

			if CUI.__ng__ or @_show_at_position
				# we allow an overlap push for certain placements,
				# that means, if we cut the layer we allow it to
				# be positioned outside the viewport (but inside the window)
				overlap_height = dim_layer.borderBoxHeight - layer_pos.height

				if overlap_height > 0
					switch vp.overlap_align
						when "bottom"
							vp.overlap_height = Math.min(layer_pos.top - vp.window_top, overlap_height)
							layer_pos.top = layer_pos.top - vp.overlap_height
							layer_pos.height = layer_pos.height + vp.overlap_height
						when "top"
							vp.overlap_height = Math.min(vp.window_bottom - layer_pos.top - layer_pos.height, overlap_height)
							layer_pos.height = layer_pos.height + vp.overlap_height


				overlap_width = dim_layer.borderBoxWidth - layer_pos.width

				if overlap_width > 0
					switch vp.overlap_align
						when "right"
							vp.overlap_width = Math.min(layer_pos.left - vp.window_left, overlap_width)
							layer_pos.left = layer_pos.left - vp.overlap_width
							layer_pos.width = layer_pos.width + vp.overlap_width
						when "left"
							vp.overlap_height = Math.min(vp.window_right - layer_pos.right, overlap_width)
							layer_pos.width = layer_pos.width + vp.overlap_width

			if vp.dim_pointer
				# now align the pointer within the available viewport
