GeezerVison is showing maxgraph.github.io — ImageShape | @maxgraph/core
Constructors
constructor
-
new ImageShape( bounds: Rectangle, imageSrc: string, fill?: string, stroke?: string, strokeWidth?: number,): ImageShape
Parameters
- bounds: Rectangle
- imageSrc: string
- fill: string = '#FFFFFF'
- stroke: string = '#000000'
- strokeWidth: number = 1
Returns ImageShape
Properties
antiAlias
antiAlias: boolean = true
Rendering hint for configuring the canvas.
boundingBox
Contains the bounding box of the shape, that is, the smallest rectangle
that includes all pixels of the shape.
bounds
Holds the Rectangle that specifies the bounds of this shape.
cursor
cursor: string = ''
dialect
Holds the dialect in which the shape is to be painted.
endArrow
endArrow: string = NONE
endSize
endSize: number = 1
fillOpacity
fillOpacity: number = 100
flipH
flipH: boolean = false
flipV
flipV: boolean = false
glass
glass: boolean = false
gradient
gradient: string = NONE
imageSrc
imageSrc: string | null = null
indicator
indicator: Shape | null = null
indicatorColor
indicatorColor: string = NONE
indicatorGradientColor
indicatorGradientColor: string = NONE
indicatorImageSrc
indicatorImageSrc: string | null = null
indicatorShape
indicatorShape: typeof Shape | null = null
indicatorStrokeColor
indicatorStrokeColor: string = NONE
isDashed
isDashed: boolean = false
isRounded
isRounded: boolean = false
isShadow
isShadow: boolean = false
minSvgStrokeWidth
minSvgStrokeWidth: number = 1
Minimum stroke width for SVG output.
node
node: SVGGElement
Holds the outermost DOM node that represents this shape.
opacity
opacity: number = 100
originalPointerEvents
originalPointerEvents: boolean | null = null
outline
outline: boolean = false
Specifies if the shape should be drawn as an outline. This disables all
fill colors and can be used to disable other drawing states that should
not be painted for outlines. Default is false. This should be set before
calling .
pointerEvents
pointerEvents: boolean = true
Specifies if pointer events should be handled. Default is true.
points
points: ( Point | null) [] = []
Holds the array of that specify the points of this shape.
preserveImageAspect
preserveImageAspect: boolean = false
Switch to preserve image aspect.
rotation
rotation: number = 0
scale
scale: number = 1
Holds the scale in which the shape is being painted.
shapePointerEvents
shapePointerEvents: boolean = false
Specifies if pointer events outside of shape should be handled. Default
is false.
spacing
spacing: number = 0
startArrow
startArrow: string = NONE
startSize
startSize: number = 1
state
Optional reference to the corresponding .
stencilPointerEvents
stencilPointerEvents: boolean = false
Specifies if pointer events outside of stencils should be handled. Default
is false. Set this to true for backwards compatibility with the 1.x branch.
stroke
stroke: string = NONE
strokeOpacity
strokeOpacity: number = 100
strokeWidth
strokeWidth: number = 1
style
Optional reference to the style of the corresponding .
svgPointerEvents
svgPointerEvents: string = 'all'
Specifies if pointer events should be handled. Default is true.
svgStrokeTolerance
svgStrokeTolerance: number = 8
useSvgBoundingBox
useSvgBoundingBox: boolean = true
Allows to use the SVG bounding box in SVG. Default is false for performance
reasons.
verticalTextRotation
verticalTextRotation: number = 0
visible
visible: boolean = true
Specifies if the shape is visible. Default is true.
Methods
addPoints
-
addPoints( c: AbstractCanvas2D, pts: Point[], rounded?: boolean, arcSize: number, close?: boolean, exclude?: number[], initialMove?: boolean,): void
Paints the given points with rounded corners.
Parameters
- c: AbstractCanvas2D
- pts: Point[]
- rounded: boolean = false
- arcSize: number
- close: boolean = false
- exclude: number[] = []
- initialMove: boolean = true
Returns void
afterPaint
-
Invokes after paint was called.
Returns void
apply
-
Overrides to replace the fill and stroke colors with the respective values from imageBackground and imageBorder.
Applies the style of the given CellState to the shape. This implementation assigns the following styles to local fields:
- imageBackground => fill
- imageBorder => stroke
Returns void
augmentBoundingBox
-
Augments the bounding box with the strokewidth and shadow offsets.
Returns void
beforePaint
-
Invoked before paint is called.
Returns void
checkBounds
-
checkBounds(): boolean | null
Returns true if the bounds are not null and all of its variables are numeric.
Returns boolean | null
clear
-
Removes all child nodes and resets all CSS.
Returns void
configureCanvas
-
configureCanvas( c: AbstractCanvas2D, x: number, y: number, w: number, h: number,): void
Sets the state of the canvas for drawing the shape.
Returns void
create
-
Creates and returns the DOM node for the shape.
This implementation assumes that maxGraph produces SVG elements.
Returns SVGGElement
createBoundingBox
-
Returns a new rectangle that represents the bounding box of the bare shape
with no shadows or strokewidths.
createCanvas
-
Creates a new canvas for drawing this shape. May return null.
createSvgCanvas
-
Creates and returns an SvgCanvas2D for rendering this shape.
createTransparentSvgRectangle
-
createTransparentSvgRectangle( x: number, y: number, w: number, h: number,): SVGRectElement
Adds a transparent rectangle that catches all events.
Parameters
- x: number
- y: number
- w: number
- h: number
Returns SVGRectElement
destroy
-
Destroys the shape by removing it from the DOM and releasing the DOM
node associated with the shape using Event#release.
Returns void
destroyCanvas
-
Destroys the given canvas which was used for drawing. This implementation
increments the reference counts on all shared gradients used in the canvas.
Returns void
getArcSize
-
getArcSize(w: number, h: number): number
Returns the arc size for the given dimension.
Returns number
ProtectedgetBaseArcSize
-
Base arc size for the shape, taken from the style.
Returns number
getCursor
-
Returns the current cursor.
Returns string
getGradientBounds
-
Returns the bounding box for the gradient box for this shape.
getLabelBounds
-
Returns the Rectangle for the label bounds of this shape, based on the
given scaled and translated bounds of the shape. This method should not
change the rectangle in-place. This implementation returns the given rect.
getLabelMargins
-
Returns the scaled top, left, bottom and right margin to be used for
computing the label bounds as an Rectangle, where the bottom and right
margin are defined in the width and height of the rectangle, respectively.
getRotation
-
Returns the rotation from the style.
Returns number
getShapeRotation
-
getShapeRotation(): number
Returns the actual rotation of the shape.
Returns number
getSvgScreenOffset
-
getSvgScreenOffset(): number
Disables offset in IE9 for crisper image output.
Returns number
getTextRotation
-
getTextRotation(): number
Returns the rotation for the text label.
Returns number
init
-
init(container: HTMLElement | SVGElement): void
Initializes the shape by adding it into the given container if the node of the shape doesn't already have a parent.
Parameters
- container: HTMLElement | SVGElement
DOM node that will contain the shape.
Returns void
initStyles
-
Sets the styles to their default values.
Returns void
isHtmlAllowed
-
Returns true for non-rounded, non-rotated shapes with no glass gradient.
Returns boolean
isPaintBoundsInverted
-
isPaintBoundsInverted(): boolean
Returns true if the bounds should be inverted.
Returns boolean
isRoundable
-
isRoundable( c: AbstractCanvas2D, x: number, y: number, w: number, h: number,): boolean
Disables inherited roundable support.
Returns boolean
paintBackground
-
paintBackground( c: AbstractCanvas2D, x: number, y: number, w: number, h: number,): void
Generic background painting implementation.
Returns void
paintEdgeShape
-
Hook for subclassers. This implementation is empty.
Returns void
paintForeground
-
paintForeground( c: AbstractCanvas2D, x: number, y: number, w: number, h: number,): void
Generic background painting implementation.
Returns void
paintGlassEffect
-
paintGlassEffect( c: AbstractCanvas2D, x: number, y: number, w: number, h: number, arc: number,): void
Paints the glass gradient effect.
Returns void
paintVertexShape
-
paintVertexShape( c: AbstractCanvas2D, x: number, y: number, w: number, h: number,): void
Generic background painting implementation.
Returns void
redrawShape
-
Updates the SVG or VML shape.
Returns void
setCursor
-
setCursor(cursor: string): void
Sets the cursor on the given shape.
Returns void
setTransparentBackgroundImage
-
setTransparentBackgroundImage(node: SVGElement): void
Sets a transparent background CSS style to catch all events.
Paints the line shape.
Returns void
updateBoundingBox
-
updateBoundingBox(): void
updateBoundsFromPoints
-
updateBoundsFromPoints(): void
Updates the bounds based on the points.
Returns void
updateTransform
-
updateTransform( c: AbstractCanvas2D, x: number, y: number, w: number, h: number,): void
Sets the scale and rotation on the given canvas.
Returns void
On This Page
Constructors
Properties
Methods
|