Sha256: 8862f93981748794ad665fffcc11c5626822bd6b8ecfc0622de28bdd4d8e935b
Contents?: true
Size: 931 Bytes
Versions: 1
Compression:
Stored size: 931 Bytes
Contents
module Ym4r module GmPlugin #A point in pixel coordinates class GPoint < Struct.new(:x,:y) include MappingObject def create "new GPoint(#{x},#{y})" end end #A rectangular that contains all the pixel points passed as arguments class GBounds include MappingObject attr_accessor :points #Accepts both an array of GPoint and an array of 2-element arrays def initialize(points) if !points.empty? and points[0].is_a?(Array) @points = points.collect { |pt| GPoint.new(pt[0],pt[1]) } else @points = points end end def create "new GBounds([#{@points.map { |pt| pt.to_javascript}.join(",")}])" end end #A size object, in pixel space class GSize < Struct.new(:width,:height) include MappingObject def create "new GSize(#{width},#{height})" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ym4r_gm-0.2.0 | lib/gm_plugin/point.rb |