angular-areas
angular-areas copied to clipboard
How to instantiate a dynamic area of arrays with a speicific height and width
The array of aras is dynamic, and on click, the area which gets created needs to be a specific width and height. I have tried with following: First try: $scope.onAddArea = function (ev, box, areas, area) { box.height = 50; box.width = 50;
Second Try with ng-areas-extend-data: <img alt="signature" ng-areas="Signatures" ng-areas-width="800" ng-areas-on-add="onAddArea" ng-areas-extend-data="{height:50,width:300}"
None of these open up the area with the specific size. Could you please help?
If you look at the documentation the onAddArea handler takes and id as the second paramenter:
ng-areas-on-add (null): fired when a selection is released. arguments : (event, id, areas, area)
Can you try:
$scope.onAddArea = function(ev, boxId, areas, area) {
area.height=50;
area.width=50;
}
you might need to use $scope.$apply();
It have been a while since the last time I worked with this library, so please let me know if this helps or not.
Thanks for your reply. area is coming as undefined thats why I could not assign height and width here.ev = m.Event {type: "onAdd", timeStamp: 1515736285258, jQuery111202042453870409371: true, isTrigger: 3, namespace: "", …}, boxId = {areaid: 0, x: 103, y: 90, z: 100, height: 0, …}, areas = [{…}], area = undefined And boxId has the height and width, which is why I tried putting values to this, but they do not take effect. already using $scope.apply(). Regards, Vandana
On Thursday 11 January 2018, 5:22:45 PM IST, delkant <[email protected]> wrote:
If you look at the documentation the onAddArea handler takes and id as the second paramenter:
ng-areas-on-add (null): fired when a selection is released. arguments : (event, id, areas, area)
Can you try:
$scope.onAddArea = function(ev, boxId, areas, area) { area.height=50; area.width=50; }
you might need to use $scope.$apply();
It have been a while since the last time I worked with this library, so please let me know if this helps or not.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.