我在一个容器内有一个ng-click元素,不应该执行这个click操作.它具有与此类似的结构:
<div class="container" ng-click="takeSomeAction()>
<p>Some content</p>
<a class="btn" ng-href="#{{whatever}}">button content</a>
</div>
Run Code Online (Sandbox Code Playgroud)
takeSomeAction()单击按钮时如何防止执行?
请在firefox上运行此测试.
http://jsperf.com/static-arithmetic
你会如何解释结果?
这个
b = a + 5*5;
b = a + 6/2;
b = a + 7+1;
Run Code Online (Sandbox Code Playgroud)
执行速度比
b = a + 25;
b = a + 3;
b = a + 8;
Run Code Online (Sandbox Code Playgroud)
为什么?
使用SDL 1.3我想在linux下创建假的全屏SDL_Window.如果我只有一个显示器很容易.我刚刚获得当前显示模式并创建了一个窗口.
SDL_GetDesktopDisplayMode(0, &mode);
SDL_Window *win = SDL_CreateWindow("my window",
0,0,mode.w, mode.h,
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS );
Run Code Online (Sandbox Code Playgroud)
但是当我有两个显示器时,事情会变得复杂.窗口分布在多个监视器上.SDL只能看到一个双倍大小的虚拟显示器.
我用这段代码测试了它
int num = SDL_GetNumVideoDisplays();
for( int i=0; i < num; i++ )
{
SDL_Rect displayRect;
SDL_GetDisplayBounds( i, &displayRect );
std::cout
<< "display " << i << ": x,y,w,h("
<< displayRect.x << ", "
<< displayRect.y << ", "
<< displayRect.w << ", "
<< displayRect.h << ")"
<< std::endl;
}
Run Code Online (Sandbox Code Playgroud)
输出:
display 0: x,y,w,h(0, 0, 2960, 1050)
Run Code Online (Sandbox Code Playgroud)
但我有两个显示器(1680x1050和1280x1024).
如何强制窗口只保留一个(假设主要)显示?