Add a single handle to rectangle
480577
function addRectHandle($canvas, parent, px, py) {
	var handle, cursor;

	// Determine cursor to use depending on handle's placement
	if ((px === -1 && py === -1) || (px === 1 && py === 1)) {
		cursor = 'nwse-resize';
	} else if (px === 0 && (py === -1 || py === 1)) {
		cursor = 'ns-resize';
	} else if ((px === -1 || px === 1) && py === 0) {
		cursor = 'ew-resize';
	} else if ((px === 1 && py === -1) || (px === -1 && py === 1)) {
		cursor = 'nesw-resize';
	}

	handle = $.extend({
		// Set cursors for handle
		cursors: {
			mouseover: cursor
		}
	}, parent.handle, {
		// Define constant properties for handle
		layer: true,
		draggable: true,
		x: parent.x + ((px * parent.width / 2) + ((parent.fromCenter) ? 0 : parent.width / 2)),
		y: parent.y + ((py * parent.height / 2) + ((parent.fromCenter) ? 0 : parent.height / 2)),
		_parent: parent,
		_px: px,
		_py: py,
		fromCenter: true,
		dragstart: function (layer) {
			$(this).triggerLayerEvent(layer._parent, 'handlestart');
		},
		// Resize rectangle when dragging a handle
		drag: function (layer) {
			var parent = layer._parent;

			if (parent.width + (layer.dx * layer._px) < parent.minWidth) {
				parent.width = parent.minWidth;
				layer.dx = 0;
			}
			if (parent.height + (layer.dy * layer._py) < parent.minHeight) {
				parent.height = parent.minHeight;
				layer.dy = 0;
			}

			if (!parent.resizeFromCenter) {
				// Optionally constrain proportions
				if (parent.constrainProportions) {
					if (layer._py === 0) {
						// Manage handles whose y is at layer's center
						parent.height = parent.width / parent.aspectRatio;
					} else {
						// Manage every other handle
						parent.width = parent.height * parent.aspectRatio;
						layer.dx = layer.dy * parent.aspectRatio * layer._py * layer._px;
					}
				}
				// Optionally resize rectangle from corner
				if (parent.fromCenter) {
					parent.width += layer.dx * layer._px;
					parent.height += layer.dy * layer._py;
				} else {
					// This is simplified version based on math. Also you can write this using an if statement for each handle
					parent.width += layer.dx * layer._px;
					if (layer._px !== 0) {
						parent.x += layer.dx * ((1 - layer._px) && (1 - layer._px) / Math.abs((1 - layer._px)));
					}
					parent.height += layer.dy * layer._py;
					if (layer._py !== 0) {
						parent.y += layer.dy * ((1 - layer._py) && (1 - layer._py) / Math.abs((1 - layer._py)));
					}
				}
				// Ensure diagonal handle does not move
				if (parent.fromCenter) {
					if (layer._px !== 0) {
						parent.x += layer.dx / 2;
					}
					if (layer._py !== 0) {
						parent.y += layer.dy / 2;
					}
				}
			} else {
				// Otherwise, resize rectangle from center
				parent.width += layer.dx * layer._px * 2;
				parent.height += layer.dy * layer._py * 2;
				// Optionally constrain proportions
				if (parent.constrainProportions) {
					if (layer._py === 0) {
						// Manage handles whose y is at layer's center
						parent.height = parent.width / parent.aspectRatio;
					} else {
						// Manage every other handle
						parent.width = parent.height * parent.aspectRatio;
					}
				}
			}
			updateRectHandles(parent);
			$(this).triggerLayerEvent(parent, 'handlemove');
		},
		dragstop: function (layer) {
			var parent = layer._parent;
			$(this).triggerLayerEvent(parent, 'handlestop');
		},
		dragcancel: function (layer) {
			var parent = layer._parent;
			$(this).triggerLayerEvent(parent, 'handlecancel');
		}
	});
	$canvas.draw(handle);
	// Add handle to parent layer's list of handles
	parent._handles.push($canvas.getLayer(-1));
}
360878
private Long handleToId(Object handle) {
        if (handle instanceof Long) {
            return (Long) handle;
        } else {
            throw new IllegalArgumentException("Expected handle to be a Long, but was: " +
                    handle.getClass().getCanonicalName());
        }
    }
1219423
public static boolean addHandle(VirtualFile owner, Closeable handle) {
        RegistryEntry entry = getEntry(owner);
        return entry.handles.add(handle);
    }
1297426
function (x, y, width, height) {
    return new BVG('rect', x.constructor.name === 'Object' ? x : {
      x: x,
      y: y,
      width: width,
      height: height
    });
  }
984023
def rect(self, x, y, width, height, color):
        
        self.context.set_source_rgb(*color)
        self.context.rectangle(self.tx(x), self.ty(y), self.tx(width), self.ty(height))
        self.context.fill()
124064
def _pad_block(self, handle):
        ''''''
        extra = handle.tell() % 512
        if extra:
            handle.write(b'\x00' * (512 - extra))
355446
function (x, y, width, height) {

		// create a dummy element
		var clipRect = this.createElement();

		// mimic a rectangle with its style object for automatic updating in attr
		return extend(clipRect, {
			members: [],
			left: x,
			top: y,
			width: width,
			height: height,
			getCSS: function (inverted) {
				var rect = this,//clipRect.element.style,
					top = rect.top,
					left = rect.left,
					right = left + rect.width,
					bottom = top + rect.height,
					ret = {
						clip: 'rect(' +
							mathRound(inverted ? left : top) + 'px,' +
							mathRound(inverted ? bottom : right) + 'px,' +
							mathRound(inverted ? right : bottom) + 'px,' +
							mathRound(inverted ? top : left) + 'px)'
					};

				// issue 74 workaround
				if (!inverted && docMode8) {
					extend(ret, {
						width: right + PX,
						height: bottom + PX
					});
				}
				return ret;
			},

			// used in attr and animation to update the clipping of all members
			updateClipping: function () {
				each(clipRect.members, function (member) {
					member.css(clipRect.getCSS(member.inverted));
				});
			}
		});

	}
321441
def addHandler(name, basepath=None, baseurl=None, allowDownscale=False):
    """"""
    if basepath is None:
        basepath = '.'
    _handlers.append(_handler_classes[name](basepath, baseurl, allowDownscale))
1317223
function addInteraction() {
  const value = typeSelect.value;
  if (value !== 'None') {
    draw = new Draw({
      source: source,
      type: typeSelect.value,
      freehand: true
    });
    map.addInteraction(draw);
  }
}
1202428
def add_rect(self, width, height, rid=None):
        
        assert(width > 0 and height > 0)
        if width > max(self.width, self.height) or\
            height > max(self.height, self.width):
            return None

        rect = None
        # If Waste managment is enabled, first try to place the rectangle there
        if self._waste_management:
            rect = self._waste.add_rect(width, height, rid)

        # Get best possible rectangle position
        if not rect:
            rect, _ = self._select_position(width, height)
            if rect:
                self._add_skyline(rect)

        if rect is None:
            return None
        
        # Store rectangle, and recalculate skyline
        rect.rid = rid
        self.rectangles.append(rect)
        return rect
835784
function addRectGuides($canvas, parent) {
	var guideProps, guide;
	guideProps = $.extend({}, parent.guide, {
		layer: true,
		draggable: false,
		type: 'rectangle',
		handle: null
	});
	$canvas.addLayer(guideProps);
	guide = $canvas.getLayer(-1);
	parent._guide = guide;
	$canvas.moveLayer(guide, -parent._handles.length - 1);
	updateRectGuides(parent);
}
669211
def draw_rectangle(x, y, width, height, attr = {})
            load!

            stroke_color  = attr.fetch(:stroke_color, DEFAULT_STROKE_COLOR)
            fill_color    = attr.fetch(:fill_color, DEFAULT_FILL_COLOR)
            line_cap      = attr.fetch(:line_cap, DEFAULT_LINECAP)
            line_join     = attr.fetch(:line_join, DEFAULT_LINEJOIN)
            line_width    = attr.fetch(:line_width, DEFAULT_LINEWIDTH)
            dash_pattern  = attr.fetch(:dash, DEFAULT_DASHPATTERN)

            stroke        = attr[:stroke].nil? ? true : attr[:stroke]
            fill          = attr[:fill].nil? ? false : attr[:fill]

            stroke = true if fill == false and stroke == false

            set_fill_color(fill_color) if fill
            set_stroke_color(stroke_color) if stroke
            set_line_width(line_width)
            set_line_cap(line_cap)
            set_line_join(line_join)
            set_dash_pattern(dash_pattern)

            if @canvas.gs.text_state.is_in_text_object?
                @instructions << PDF::Instruction.new('ET').render(@canvas)
            end

            @instructions << PDF::Instruction.new('re', x,y,width,height).render(@canvas)

            @instructions << (i =
                if stroke and not fill
                    PDF::Instruction.new('S')
                elsif fill and not stroke
                    PDF::Instruction.new('f')
                elsif fill and stroke
                    PDF::Instruction.new('B')
                end
            )

            i.render(@canvas)

            self
        end
727954
def rectangle(upper_left_x, upper_left_y, lower_right_x, lower_right_y)
      primitive 'rectangle ' + format('%g,%g %g,%g',
                                      upper_left_x, upper_left_y, lower_right_x, lower_right_y)
    end
842650
function (x, y, width, height, r, strokeWidth) {

		var wrapper = this.symbol('rect');
		wrapper.r = isObject(x) ? x.r : r;

		//return wrapper.attr(wrapper.crisp(strokeWidth, x, y, mathMax(width, 0), mathMax(height, 0)));
		return wrapper.attr(
				isObject(x) ?
					x :
					// do not crispify when an object is passed in (as in column charts)
					wrapper.crisp(strokeWidth, x, y, mathMax(width, 0), mathMax(height, 0))
			);
	}
795658
def filled_rectangle(self, x0, y0, x1, y1):
        """"""
        x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1)
        for x in range(x0, x1 + 1):
            for y in range(y0, y1 + 1):
                self.point(x, y, self.color)
1371859
def rectangle(self, rect, attr=None, fill=u' '):
        '''
        oldtop = self.WindowTop
        oldpos = self.pos()
        #raise NotImplementedError
        x0, y0, x1, y1 = rect
        if attr is None:
            attr = self.attr
        if fill:
            rowfill = fill[:1] * abs(x1 - x0)
        else:
            rowfill = u' ' * abs(x1 - x0)
        for y in range(y0, y1):
                System.Console.SetCursorPosition(x0, y)
                self.write_color(rowfill, attr)
        self.pos(*oldpos)
448660
def update_handles(self, key, axis, element, ranges, style):
        
        self.teardown_handles()
        plot_data, plot_kwargs, axis_kwargs = self.get_data(element, ranges, style)

        with abbreviated_exception():
            handles = self.init_artists(axis, plot_data, plot_kwargs)
        self.handles.update(handles)
        return axis_kwargs