| 1 |
// Copyright 2007 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
|
| 16 |
/** |
| 17 |
* @fileoverview A thick wrapper around elements with stroke and fill. |
| 18 |
* @author [email protected] (Robby Walker) |
| 19 |
*/ |
| 20 |
|
| 21 |
|
| 22 |
goog.provide('goog.graphics.ext.StrokeAndFillElement'); |
| 23 |
|
| 24 |
goog.require('goog.graphics.ext.Element'); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* Interface for a graphics element that has a stroke and fill. |
| 30 |
* This is the base interface for ellipse, rectangle and other |
| 31 |
* shape interfaces. |
| 32 |
* You should not construct objects from this constructor. Use a subclass. |
| 33 |
* @param {goog.graphics.ext.Group} group Parent for this element. |
| 34 |
* @param {goog.graphics.StrokeAndFillElement} wrapper The thin wrapper to wrap. |
| 35 |
* @constructor |
| 36 |
* @extends {goog.graphics.ext.Element} |
| 37 |
*/ |
| 38 |
goog.graphics.ext.StrokeAndFillElement = function(group, wrapper) { |
| 39 |
goog.graphics.ext.Element.call(this, group, wrapper); |
| 40 |
}; |
| 41 |
goog.inherits( |
| 42 |
goog.graphics.ext.StrokeAndFillElement, goog.graphics.ext.Element); |
| 43 |
|
| 44 |
|
| 45 |
/** |
| 46 |
* Sets the fill for this element. |
| 47 |
* @param {goog.graphics.Fill?} fill The fill object. |
| 48 |
*/ |
| 49 |
goog.graphics.ext.StrokeAndFillElement.prototype.setFill = function(fill) { |
| 50 |
this.getWrapper().setFill(fill); |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
/** |
| 55 |
* Sets the stroke for this element. |
| 56 |
* @param {goog.graphics.Stroke?} stroke The stroke object. |
| 57 |
*/ |
| 58 |
goog.graphics.ext.StrokeAndFillElement.prototype.setStroke = function(stroke) { |
| 59 |
this.getWrapper().setStroke(stroke); |
| 60 |
}; |
| 61 |
|
| 62 |
|
| 63 |
/** |
| 64 |
* Redraw the rectangle. Called when the coordinate system is changed. |
| 65 |
* @protected |
| 66 |
* @override |
| 67 |
*/ |
| 68 |
goog.graphics.ext.StrokeAndFillElement.prototype.redraw = function() { |
| 69 |
this.getWrapper().reapplyStroke(); |
| 70 |
}; |