Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, February 21, 2017 11:17:48 AM(UTC)

maneka  
maneka

Groups: Registered
Posts: 17

Thanks: 1 times

Hello,

I currently have the following setup
Code:

var div = document.getElementById('image');


                var options = new lt.Controls.ImageViewerCreateOptions(div);
                options.useElements = true;

                var verticalLayout = new lt.Controls.ImageViewerVerticalViewLayout();
                verticalLayout.columns = 2;

                options.viewLayout = verticalLayout;

                var imageViewer = new lt.Controls.ImageViewer(options);
                
                imageViewer.restrictScroll = false;
                imageViewer.viewHorizontalAlignment = lt.Controls.ControlAlignment.center;
                imageViewer.viewVerticalAlignment = lt.Controls.ControlAlignment.center;

                imageViewer.interactiveModes.beginUpdate();
                for (var i = 0; i < $scope.interactiveModes.length; i++) {
                    var mode= $scope.interactiveModes[i];
                    mode.isEnabled = false;
                    if (mode.name == 'SelectItems') {
                        (mode).selectionMode = lt.Controls.ImageViewerSelectionMode.single;
                    }
                    imageViewer.interactiveModes.add(mode);
                }

                imageViewer.interactiveModes.endUpdate();
                imageViewer.interactiveModes.enableByIndex(0);

                _imageViewer = imageViewer;

                addItemsToImageViewer(4);
                _imageViewer.zoom(lt.Controls.ControlSizeMode.fitWidth, 1, _imageViewer.defaultZoomOrigin);

}
 var addItemsToImageViewer= function(itemCount, atIndex)
            {
                _imageViewer.beginTransform();

                for (var i = 0; i < itemCount; i++) {
                    var item = new lt.Controls.ImageViewerItem();
                    var url = window.location.origin+config.BaseUrl+'/'+fileName[i];
                    item.url = url;
                    if (!isNaN(atIndex)) {
                        _imageViewer.items.insert(atIndex, item);
                    } else {
                        _imageViewer.items.add(item);
                    }
                }
                _imageViewer.endTransform();
            };


What I would like to do is to annotate the items. Are there any examples of how this can be achieved.

I have attempted the following possible scenario however the image is not loaded

Code:

 window.onload = function () {

            var interactiveModes = [
            new lt.Annotations.JavaScript.AutomationInteractiveMode(),
            new lt.Controls.ImageViewerPanZoomInteractiveMode(),
            new lt.Controls.ImageViewerNoneInteractiveMode(),
            new lt.Controls.ImageViewerCenterAtInteractiveMode(),
            new lt.Controls.ImageViewerZoomToInteractiveMode(),
            new lt.Controls.ImageViewerSelectItemsInteractiveMode()
            ];

            var imageViewerDiv = document.getElementById("imageViewerDiv");
            var createOptions = new lt.Controls.ImageViewerCreateOptions(imageViewerDiv);
            createOptions.useElements = true;
            var imageViewer = new lt.Controls.ImageViewer(createOptions);
            imageViewer.beginTransform();
            var item = new lt.Controls.ImageViewerItem();
            item.url = "http://localhost:58137/Images/Default/default.jpg";
            //imageViewer.imageUrl = "Images/Default/default.jpg"; //the image is loaded properly this way and can annotate 
            imageViewer.items.add(item);
            imageViewer.endTransform();
           

            imageViewer.interactiveModes.beginUpdate();
            for (var i = 0; i < interactiveModes.length; i++) {
                var mode = interactiveModes[i];
                mode.isEnabled = false;
                if (mode.name == 'SelectItems') {
                    (mode).selectionMode = lt.Controls.ImageViewerSelectionMode.single;
                }
                imageViewer.interactiveModes.add(mode);
            }

            imageViewer.interactiveModes.endUpdate();
            imageViewer.interactiveModes.enableByIndex(0);

            var renderingEngine = new lt.Annotations.Rendering.AnnHtml5RenderingEngine();
            var manager = new lt.Annotations.Automation.AnnAutomationManager.create(renderingEngine);
            manager.createDefaultObjects();
            manager.editObjectAfterDraw = false;

            var automationControl = new lt.Annotations.JavaScript.ImageViewerAutomationControl();
            automationControl.imageViewer = imageViewer;

            var automation = new lt.Annotations.Automation.AnnAutomation(manager, automationControl);
            imageViewer.itemChanged.add(function (sender, e) {
                var container = automation.container;
                container.size = container.mapper.sizeToContainerCoordinates(imageViewer.imageSize);
                manager.currentObjectId = lt.Annotations.Core.AnnObject.freehandObjectId;
            });
            automation.active = true;
            imageViewer.autoCreateCanvas = true;
        };

thank you
Maneka
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, February 24, 2017 4:40:53 PM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 218

Was thanked: 12 time(s) in 12 post(s)

Maneka,

This is the same issue that I helped you with on this forum post:

https://www.leadtools.co...s-via-image-viewer-items

Please let me know if this isn't what you need.
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Monday, February 27, 2017 6:36:49 AM(UTC)

maneka  
maneka

Groups: Registered
Posts: 17

Thanks: 1 times

Hi
yes. This was posted because when I edited the other one a server error occurred so I wasn't sure if the message got posted

Thank you
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.049 seconds.