aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/MTools.pm24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/MTools.pm b/src/MTools.pm
index 91306ad..d47d81e 100644
--- a/src/MTools.pm
+++ b/src/MTools.pm
@@ -75,6 +75,8 @@ package MTools;
# - rotate
# - coords
# - bbox
+# - width
+# - height
# - type
# - tset
# - treset
@@ -93,7 +95,7 @@ BEGIN
@ISA = qw / Exporter/;
@EXPORT = qw / %fonts $zinc translate rotate executer mconfigure binding unbinding raise mget
scale getGradient chggroup plink plisten mplaying minstance mrun minstanciate
- propertyExists bbox mdelete mfind coords type tset treset tget clone unplisten/;
+ propertyExists bbox width height mdelete mfind coords type tset treset tget clone unplisten/;
}
use strict;
@@ -454,13 +456,25 @@ sub treset {
}
sub bbox {
- my ($obj) = @_;
- return $zinc -> bbox (ref ($obj) eq '' ? $obj : $obj -> {instance});
+ my ($obj) = @_;
+ return $zinc -> bbox (ref ($obj) eq '' ? $obj : $obj -> {instance});
+}
+
+sub width {
+ my ($obj) = @_;
+ my ($x1,$y1,$x2,$y2) = bbox($obj);
+ return ($x2 - $x1);
+}
+
+sub height {
+ my ($obj) = @_;
+ my ($x1,$y1,$x2,$y2) = bbox($obj);
+ return ($y2 - $y1);
}
sub coords {
- my ($obj, @args) = @_;
- return $zinc -> coords (ref ($obj) eq '' ? $obj : $obj -> {instance}, @args);
+ my ($obj, @args) = @_;
+ return $zinc -> coords (ref ($obj) eq '' ? $obj : $obj -> {instance}, @args);
}
sub type {