rect

如何判断DOM元素在当前视口中是否可见?

别说谁变了你拦得住时间么 提交于 2019-12-16 18:50:37
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 有没有一种有效的方法来判断DOM元素(在HTML文档中)当前是否可见(显示在 视口中 )? (问题是指Firefox) #1楼 请参阅使用 getBoundingClientRect 的 边缘 源。 就像是: function inViewport (el) { var r, html; if ( !el || 1 !== el.nodeType ) { return false; } html = document.documentElement; r = el.getBoundingClientRect(); return ( !!r && r.bottom >= 0 && r.right >= 0 && r.top <= html.clientHeight && r.left <= html.clientWidth ); } 如果元素的 任何 部分在视口中,则返回 true 。 #2楼 更新: 时间在前进,我们的浏览器也在前进。 不再推荐 使用 此技术, 如果不需要支持IE <7,则应使用下面的 @Dan 解决方案( https://stackoverflow.com/a/7557433/5628 )。 原始解决方案(现已过时): 这将检查该元素在当前视口中是否完全可见: function

EasyPR--开发详解(7)字符分割

99封情书 提交于 2019-12-16 17:01:59
  大家好,好久不见了。   一转眼距离上一篇博客已经是 4 个月前的事了。要问博主这段时间去干了什么,我只能说:我去“ 外面看了看”。 图1 我想去看看      在外面跟几家创业公司谈了谈,交流了一些大数据与机器视觉相关的心得与经验。不过由于各种原因,博主又回来了。   目前,博主的工作是在本地的一个高校做科研。而研究的方向主要是计算机视觉。 图2 科研就是不断的探索过程   由于我所做的是计算机视觉方向,跟EasyPR本身非常契合。未来这个这个系列的博客会继续下去,并且以后会有更加专业的内容。   目前我研究的方向是文字定位,这个技术跟车牌定位很像,都是在图中去定位一些语言相关的位置。不同之处在于,车牌定位只需要处理的是在车牌中出现的文字,字体,颜色都比较固定,背景也比相对单一(蓝色和黄色等)。   文字定位则复杂很多,研究界目前要处理的是是各种类型,不同字体,且拥有复杂背景的文字。下图是一张样例: 图3 文字定位图片样例   可以看出,文字定位要处理的问题是类似车牌定位的,不过难度要更大。一些文字定位的技术也应该可以应用于车牌的定位和识别。   未来EasyPR会借鉴文字定位的一些思想和技术,来强化其定位的效果。 一.前言   今天继续我们 EasyPR的 开发详解。   这几个月我收到了不少的邮件问:为什么 EasyPR 开发详解教程中只有车牌定位的部分,

Flutter学习记录——24.自定义 Widget 及方法封装

我的未来我决定 提交于 2019-12-16 09:11:32
文章目录 1.Flutter 自定义 Widget 的方式 2 Widget 的继承实现自定义 3.Widget 的组合实现自定义 4.CustomPaint 绘制 Widget 5.Flutter方法的封装 在使用 Flutter 开发的过程中,有时候现有的 Widget 不能满足需求,所以需要自定义 Widget,有点像 Android 和 iOS 平台的自定义 View,来实现我们的各种效果。Flutter 也是支持自定义 Widget 组件的,原理和方法类似于其他平台。 1.Flutter 自定义 Widget 的方式 当我们在实际开发中,可能 Flutter 的基础 Widget 组件并不能满足我们的需求,这时我们就需要自定义 Widget 来实现我们的需求。 Flutter 有多种实现自定义 Widget 的方式: 通过继承 Widget 来修改和扩展它的功能; 通过组合 Widget 来扩展功能; 使用 CustomPaint 绘制自定义 Widget。 这几种方式都有各自的优势和特点,相对来说 CustomPaint 绘制实现自定义是这里面比较复杂的一种自定义 Widget 方式。Flutter 中的很多基础 Widget 也是通过继承 Widget 进行扩展形成新的 Widget 或者是自己绘制 Widget。其实在大部分的平台都存在 Canvas 这个对象

TypeError: Argument must be rect style object - Pygame (Python [duplicate]

纵然是瞬间 提交于 2019-12-13 11:25:43
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Pygame (Python) - TypeError: Argument must be rect style object I am trying to make a brick breaker game in Pygame (with Python) but I am stuck at an error. (this is random text that is necessary so I can post all this code) CODE: import pygame, sys, time, random from pygame.locals import * pygame.init() fpsclock = pygame.time.Clock() WINDOWWIDTH = 450 WINDOWHEIGHT = 650 mainwindow = pygame.display.set_mode(

Displaying the rectangle using a for loop in SDL2 C

二次信任 提交于 2019-12-13 09:45:13
问题 I'm currently using a for loop to create 4 rectangles along the x-axis. When I run the program the image of the rectangle appears for a few millisecond before it disappears. Can you show me what I have to do in order for the image to display on the screen permanently. When I create individual rectangles it display's the image without vanishing. An example will be helpful. Thanks int main(){ int barrack1_xposition = 167,i=1; int cnt_barrack=0; SDL_Window *o = NULL; SDL_Renderer *r = NULL; SDL

Drawing rect in picturebox not done to right scale for mouse

倖福魔咒の 提交于 2019-12-13 04:56:27
问题 I currently have a picture box where the user will click and drag to draw a rectangle over an image (one that can be changed regularly). When they're done (mouse_up), I will display the relative points of the rect in a text box to the resolution. So, for example, the user draws from top left (0,0) to bottom right of a 1920 x 680 image (picturebox.right, picturebox.bottom) for a rect, the text box will show (1920,680) for the end point. That's mostly just ratio stuff. I am using the code from

Delphi: Canvas.FillRect in List View

我们两清 提交于 2019-12-11 19:36:55
问题 On change of a text of List View's SubItem I need to brush and fill a whole row: procedure TForm1.ListViewDrawItem(Sender: TCustomListView; Item: TListItem; Rect: TRect; State: TOwnerDrawState); begin if Item.SubItems[2]='Done' then begin Sender.Canvas.Font.Color := clBlack; Sender.Canvas.Brush.Color := clGreen; Sender.Canvas.Brush.Style := bsSolid; Sender.Canvas.FillRect(Rect); end; end; But Sender.Canvas. FillRect(Rect) will fill only a Rect of the SubItem. How to fill a whole row? The

How to fill half of the rectangle with color in d3.js

前提是你 提交于 2019-12-11 19:03:55
问题 Hi want a rectangle of width 250, and i want to fill the rectangle with the color based on the input value.I tried to create one rectangle of gray and another one of color skyblue on the same position to acheive this but it update the rectangle only. cant create another rectangle on the previous one. what to do.? My Js fiddle is http://jsfiddle.net/sSqmV/ i want to create an second rectangle of sky blue over the previous one of white color to acheive my task. var chart = d3.select("div.dev1")

Why the two CGRect don't intersect when they do visually?

此生再无相见时 提交于 2019-12-11 12:19:03
问题 I am building an app. It needs to accept user input from some UITextField s. And sometimes the keyboard will hide the text field so I need to move up the view when the keyboard CGRect intersects with the text field's frame . I followed this tutorial an I added some of my own logic because I have multiple text fields. Here is my relevant code: (The whole thing is in a VC that conforms to UITextFieldDelegate ) var focusedTextField: UITextField? var viewMovedUp = false var keyboardSize: CGRect!

Win81+ GetWindowRect Not Including Complete Drag Area?

不羁岁月 提交于 2019-12-11 12:16:27
问题 I am trying to get the width and height of all the windows. I did this easily with GetWindowRect however the styling in Win8.1+ seems such that there is a border on some windows and thats not being included. When I move/drag the window, this area moves with the window, so I expected it would be apart of its geometry. Is this known? Is there away to include the border width? New Example I created a second screenshot to explain after I see some confusion in the comments. I have two windows side