lib/puppeteer/element_handle/box_model.rb in puppeteer-ruby-0.40.4 vs lib/puppeteer/element_handle/box_model.rb in puppeteer-ruby-0.40.5
- old
+ new
@@ -1,14 +1,15 @@
class Puppeteer::ElementHandle < Puppeteer::JSHandle
class BoxModel
QUAD_ATTRIBUTE_NAMES = %i(content padding border margin)
# @param result [Hash]
- def initialize(result_model)
+ # @param offset [Point]
+ def initialize(result_model, offset:)
QUAD_ATTRIBUTE_NAMES.each do |attr_name|
quad = result_model[attr_name.to_s]
instance_variable_set(
:"@#{attr_name}",
- quad.each_slice(2).map { |x, y| Point.new(x: x, y: y) },
+ quad.each_slice(2).map { |x, y| Point.new(x: x, y: y) + offset },
)
end
@width = result_model['width']
@height = result_model['height']
end