Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7434001
ve.dm.ResizableNode.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ve.dm.ResizableNode.js
View Options
/*!
* VisualEditor DataModel Resizable node.
*
* @copyright See AUTHORS.txt
*/
/**
* A mixin class for resizable nodes. This class is mostly a base
* interface for resizable nodes to be able to produce scalable
* objects for further calculation.
*
* @class
* @abstract
* @constructor
*/
ve
.
dm
.
ResizableNode
=
function
VeDmResizableNode
()
{
this
.
scalable
=
null
;
this
.
connect
(
this
,
{
attributeChange
:
'onResizableAttributeChange'
}
);
};
/* Inheritance */
OO
.
initClass
(
ve
.
dm
.
ResizableNode
);
/**
* Get a scalable object for this node.
*
* #createScalable is called if one doesn't already exist.
*
* @return {ve.dm.Scalable}
*/
ve
.
dm
.
ResizableNode
.
prototype
.
getScalable
=
function
()
{
if
(
!
this
.
scalable
)
{
this
.
scalable
=
this
.
createScalable
();
}
return
this
.
scalable
;
};
/**
* Create a scalable object based on the current object's width and height.
*
* @abstract
* @return {ve.dm.Scalable}
*/
ve
.
dm
.
ResizableNode
.
prototype
.
createScalable
=
null
;
/**
* Handle attribute change events from the model.
*
* @param {string} key Attribute key
* @param {string} from Old value
* @param {string} to New value
*/
ve
.
dm
.
ResizableNode
.
prototype
.
onResizableAttributeChange
=
function
(
key
)
{
if
(
key
===
'width'
||
key
===
'height'
)
{
this
.
getScalable
().
setCurrentDimensions
(
this
.
getCurrentDimensions
()
);
}
};
/**
* Get the current dimensions from the model
*
* @return {Object} Current dimensions
*/
ve
.
dm
.
ResizableNode
.
prototype
.
getCurrentDimensions
=
function
()
{
return
{
width
:
this
.
getAttribute
(
'width'
),
height
:
this
.
getAttribute
(
'height'
)
};
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 12:11 (1 h, 21 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
42/af/75dfc326c5a53dce8cdf57212497
Default Alt Text
ve.dm.ResizableNode.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment