summaryrefslogtreecommitdiffstats
path: root/debian/missing-sources/epoch/src/core/d3.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'debian/missing-sources/epoch/src/core/d3.coffee')
-rw-r--r--debian/missing-sources/epoch/src/core/d3.coffee25
1 files changed, 25 insertions, 0 deletions
diff --git a/debian/missing-sources/epoch/src/core/d3.coffee b/debian/missing-sources/epoch/src/core/d3.coffee
new file mode 100644
index 0000000..a33d717
--- /dev/null
+++ b/debian/missing-sources/epoch/src/core/d3.coffee
@@ -0,0 +1,25 @@
+# Gets the width of the first node, or sets the width of all the nodes
+# in a d3 selection.
+# @param value [Number, String] (optional) Width to set for all the nodes in the selection.
+# @return The selection if setting the width of the nodes, or the width
+# in pixels of the first node in the selection.
+d3.selection::width = (value) ->
+ if value? and Epoch.isString(value)
+ @style('width', value)
+ else if value? and Epoch.isNumber(value)
+ @style('width', "#{value}px")
+ else
+ +Epoch.Util.getComputedStyle(@node(), null).width.replace('px', '')
+
+# Gets the height of the first node, or sets the height of all the nodes
+# in a d3 selection.
+# @param value (optional) Height to set for all the nodes in the selection.
+# @return The selection if setting the height of the nodes, or the height
+# in pixels of the first node in the selection.
+d3.selection::height = (value) ->
+ if value? and Epoch.isString(value)
+ @style('height', value)
+ else if value? and Epoch.isNumber(value)
+ @style('height', "#{value}px")
+ else
+ +Epoch.Util.getComputedStyle(@node(), null).height.replace('px', '') \ No newline at end of file