direction

Check direction of scroll in UIScrollView

谁说胖子不能爱 提交于 2019-11-27 18:56:10
问题 I am trying to implement the method scrollViewWillBeginDragging. When this method is called I check that the user has selected one of the buttons that are within the scrollview is in state:selected. If not then I display a UIAlert to inform the user. My problem here is I only want to call the button selected ( NextQuestion ) method if the user scrolls from right to left (pulling the next view from the right). But if they are scrolling from Left to Right then I want it to scroll as normal. At

Get direction (compass) with two longitude/latitude points

核能气质少年 提交于 2019-11-27 11:29:53
I'm working on a "compass" for a mobile-device. I have the following points: point 1 (current location): Latitude = 47.2246, Longitude = 8.8257 point 2 (target location): Latitude = 50.9246, Longitude = 10.2257 Also I have the following information (from my android-phone): The compass-direction in degree, wich bears to the north. For example, when I direct my phone to north, I get 0° How can I create a "compass-like" arrow wich shows me the direction to the point? Is there a mathematic-problem for this? thanks! EDIT: Okay I found a solution, it looks like this: /** * Params: lat1, long1 =>

Detecting the scrolling direction in the adapter (up/down)

て烟熏妆下的殇ゞ 提交于 2019-11-27 06:38:39
I am trying to mimic the Google Plus application in my project, as it seems to be the reference now. The listview effect when scrolling is really nice and I would like to do something similar. I have started with the LayoutAnimationController http://android-er.blogspot.be/2009/10/listview-and-listactivity-layout.html LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation( this, R.anim.list_layout_controller); getListView().setLayoutAnimation(controller); and that seems bad, as not all the elements are animated: So I ended up by using the getView of the adapter and using this

VelocityTracker 使用

风格不统一 提交于 2019-11-27 05:40:08
这个类的话是用来得到手势在屏幕上滑动的速度,也许我们用的比较少,但是还是在这里写下怎样使用VelocityTracker这个类, 第一步的话,当然是得到该类的一个实例 mVelocityTracker = VelocityTracker.obtain(); 第二步,需要告诉mVelocityTracker 这个对象你要对那个MotionEvent 进行监控(也就是说得到在那个MotionEvent 上的速度) 对于MotionEvent 的解释文档是这么说的 { 对象,用于 报告 运动 (鼠标, 笔, 手指 ,轨迹球 ) 事件 。 这个类 可能持有 绝对或相对 运动} 使用 mVelocityTracker.addMovement(ev); 方法来制定一个MotionEvent。 第三步, 这一步就相当简单了直接用 mVelocityTracker.getXVelocity(); 方法获取在水平方向上滑动的速度 用 mVelocityTracker.getYVelocity(); 方法就可以获取垂直方向上滑动的速度了。 最后的话我附上一个完整的例子让大家看的更明白点吧! VelocityTracker mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker.addMovement(ev); if (ev

MongoDB中的explain命令

核能气质少年 提交于 2019-11-27 01:32:24
执行命令显示结果 执行db.student_exam.find({student_age: 15}).explain(‘allPlansExecution’); { "queryPlanner" : { "plannerVersion" : 1.0, "namespace" : "myproject.student_exam", "indexFilterSet" : false, "parsedQuery" : { "student_age" : { "$eq" : 15.0 } }, "winningPlan" : { "stage" : "COLLSCAN", "filter" : { "student_age" : { "$eq" : 15.0 } }, "direction" : "forward" }, "rejectedPlans" : [ ] }, "executionStats" : { "executionSuccess" : true, "nReturned" : 633.0, "executionTimeMillis" : 5.0, "totalKeysExamined" : 0.0, "totalDocsExamined" : 10000.0, "executionStages" : { "stage" : "COLLSCAN", "filter" : {

Detecting and acting on keyboard direction keys in Java

▼魔方 西西 提交于 2019-11-26 21:49:19
问题 G'day all, I have a console project where it is intended the user presses the keyboard direction keys (non-numeric keypad) to move an avatar. I am having difficulty coding to check for the press of these keys. In Pascal it was easy enough to use "readkey" and code, for example, for #80 for the down keypress. However, I am stumped how to implement the same functionality in Java, though I think I understand the use of System.in and BufferedInputStream. Could anyone help me out? Your thoughts or

How can I get the direction of movement using an accelerometer?

十年热恋 提交于 2019-11-26 19:56:17
问题 I'm developing a Android application and I would like to know if is possible detect the direction of movement with one axis fixed. For example, I want put my phone on the table and detect the direction when I move it (left, right, up and down). The distance is not necessary, I just want know the accurate direction. 回答1: Yes. Using the SensorEventListener.onSensorChanged(SensorEvent event) you can determine the values provided along the X & Y axis. You would need to record these values and

一般般好看的登录页面 (vue)

最后都变了- 提交于 2019-11-26 16:14:12
没有ui,无奈只能自己上手设计页面。自己写了一个,半仿照其他demo写的,原demo很炫酷,我这个不炫酷也不丑吧 贴图: (星星每隔3秒改变颜色,有动画运动) 贴代码: 1 <template> 2 <div id="login"> 3 <div id="bgd"> 4 <canvas 5 id='myCanvas' 6 :width='width' 7 :height='height' 8 > 9 </canvas> 10 </div> 11 <div id="loginBox"> 12 <h4>登录</h4> 13 <el-form 14 :model="loginForm" 15 :rules="loginRules" 16 ref="loginForm" 17 label-width="0px" 18 > 19 <el-form-item 20 label="" 21 prop="userName" 22 style="margin-top:40px;" 23 > 24 <el-row> 25 <el-col :span='2'> 26 <span class="iconfont"></span> 27 </el-col> 28 <el-col :span='22'> 29 <el-input 30 class="inps" 31 placeholder='用户名' 32

Get direction (compass) with two longitude/latitude points

六眼飞鱼酱① 提交于 2019-11-26 15:36:07
问题 I'm working on a "compass" for a mobile-device. I have the following points: point 1 (current location): Latitude = 47.2246, Longitude = 8.8257 point 2 (target location): Latitude = 50.9246, Longitude = 10.2257 Also I have the following information (from my android-phone): The compass-direction in degree, wich bears to the north. For example, when I direct my phone to north, I get 0° How can I create a "compass-like" arrow wich shows me the direction to the point? Is there a mathematic

How to detect scroll direction

此生再无相见时 提交于 2019-11-26 12:47:58
I want to run a function when someone scrolls down on an element. Something like this: $('div').scrollDown(function(){ alert('down') }); $('div').scrollUp(function(){ alert('up') }); But those functions don't exist. Is there a solution to this problem? They seem to be able to do it. Unfortunately the source code is compressed, so no luck there... Thanks!! Rik de Vos I managed to figure it out in the end, so if anyone is looking for the answer: //Firefox $('#elem').bind('DOMMouseScroll', function(e){ if(e.originalEvent.detail > 0) { //scroll down console.log('Down'); }else { //scroll up console