@Override protected Command getCreateCommand(CreateRequest request) { Command ret = null; if (request.getNewObjectType().equals(ModuleInstancePropertyNode.class) && getHost().getModel() instanceof ModuleInstanceNode) { ModuleInstancePropertyCreateCommand cmd = new ModuleInstancePropertyCreateCommand(); Node node = (Node) request.getNewObject(); node.setParent((Node) getHost().getModel()); Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); p = node.getAnchor(p, 2); cmd.setNode((ModuleInstancePropertyNode) node); cmd.setParent((ModuleInstanceNode) node.getParent()); cmd.setLocation(new Rectangle(p.x, p.y, ModuleInstancePropertyNode.DEF_WIDTH, ModuleInstancePropertyNode.DEF_HEIGHT)); ret = cmd; } return ret; }
@Override protected Command getCreateCommand(CreateRequest request) { Command ret = null; if (request.getNewObjectType().equals(ModuleOperationParameterNode.class) && (getHost().getModel() instanceof ModuleOperationNode)) { ModuleOperationNode par = (ModuleOperationNode) getHost().getModel(); if (!(par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_READ.name()) || par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_WRITE.name()))) { ModuleOperationParameterCreateCommand cmd = new ModuleOperationParameterCreateCommand(); Node node = (Node) request.getNewObject(); node.setParent((Node) getHost().getModel()); Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); p = node.getAnchor(p, 2); cmd.setNode((ModuleOperationParameterNode) node); cmd.setParent((ModuleOperationNode) node.getParent()); cmd.setLocation(new Rectangle(p.x, p.y, ModuleOperationParameterNode.DEF_WIDTH, ModuleOperationParameterNode.DEF_HEIGHT)); ret = cmd; } } return ret; }
@Override protected Command getMoveBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointMoveCommand cmd = new BendpointMoveCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setIndex(request.getIndex()); cmd.setNewLocation(p); return cmd; }
@Override protected Command getCreateCommand(CreateRequest request) { Command ret = null; if (request.getNewObjectType().equals(ComputingNodeConfigurationNode.class) && (getHost().getModel() instanceof PlatformConfigurationNode)) { ComputingNodeConfigurationCreateCommand cmd = new ComputingNodeConfigurationCreateCommand(); Node node = (Node) request.getNewObject(); node.setParent((Node) getHost().getModel()); Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); p = node.getAnchor(p, 1); cmd.setNode((ComputingNodeConfigurationNode) node); cmd.setParent((PlatformConfigurationNode) node.getParent()); cmd.setLocation(new Rectangle(p.x, p.y, ComputingNodeConfigurationNode.DEF_WIDTH, ComputingNodeConfigurationNode.DEF_HEIGHT)); ret = cmd; } return ret; }
@Override protected Command getCreateCommand(CreateRequest request) { Command ret = null; if (request.getNewObjectType().equals(LogicalComputingPlatformNode.class) && (getHost().getModel() instanceof LogicalSystemNode)) { LogicalComputingPlatformCreateCommand cmd = new LogicalComputingPlatformCreateCommand(); Node node = (Node) request.getNewObject(); node.setParent((Node) getHost().getModel()); Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); cmd.setNode((LogicalComputingPlatformNode) node); cmd.setParent((LogicalSystemNode) node.getParent()); cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingPlatformNode.DEF_WIDTH, LogicalComputingPlatformNode.DEF_HEIGHT)); ret = cmd; } return ret; }
@Override protected Command getCreateCommand(CreateRequest request) { Command ret = null; if (request.getNewObjectType().equals(LogicalProcessorsNode.class) && (getHost().getModel() instanceof LogicalComputingNode)) { LogicalProcessorsCreateCommand cmd = new LogicalProcessorsCreateCommand(); Node node = (Node) request.getNewObject(); node.setParent((Node) getHost().getModel()); Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); p = node.getAnchor(p, 2); cmd.setNode((LogicalProcessorsNode) node); cmd.setParent((LogicalComputingNode) node.getParent()); cmd.setLocation(new Rectangle(p.x, p.y, LogicalProcessorsNode.DEF_WIDTH, LogicalProcessorsNode.DEF_HEIGHT)); ret = cmd; } return ret; }
@Override protected Command getCreateCommand(CreateRequest request) { Command ret = null; if (request.getNewObjectType().equals(LogicalComputingNode.class) && (getHost().getModel() instanceof LogicalComputingPlatformNode)) { LogicalComputingCreateCommand cmd = new LogicalComputingCreateCommand(); Node node = (Node) request.getNewObject(); node.setParent((Node) getHost().getModel()); Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); p = node.getAnchor(p, 1); cmd.setNode((LogicalComputingNode) node); cmd.setParent((LogicalComputingPlatformNode) node.getParent()); cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingNode.DEF_WIDTH, LogicalComputingNode.DEF_HEIGHT)); ret = cmd; } return ret; }
@Override protected Command getCreateCommand(CreateRequest request) { Command ret = null; if (request.getNewObjectType().equals(ComponentPropertyNode.class) && (getHost().getModel() instanceof ComponentNode)) { ComponentPropertyNodeCreateCommand cmd = new ComponentPropertyNodeCreateCommand(); Node node = (Node) request.getNewObject(); node.setParent((Node) getHost().getModel()); Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); p = node.getAnchor(p, 1); cmd.setNode((ComponentPropertyNode) node); cmd.setParent((ComponentNode) node.getParent()); cmd.setLocation(new Rectangle(p.x, p.y, ComponentPropertyNode.DEF_WIDTH, ComponentPropertyNode.DEF_HEIGHT)); ret = cmd; } return ret; }
private void showThumbnail() { // RootEditPartのビューをソースとしてサムネイルを作成 ScalableFreeformRootEditPart editPart = (ScalableFreeformRootEditPart) this.graphicalViewer .getRootEditPart(); if (this.thumbnail != null) { this.thumbnail.deactivate(); } this.thumbnail = new ScrollableThumbnail((Viewport) editPart .getFigure()); this.thumbnail.setSource(editPart .getLayer(LayerConstants.PRINTABLE_LAYERS)); this.lws.setContents(this.thumbnail); }
/** * @param lnEditparts * @return */ private boolean isMessageOnLifeLineName() { Viewport viewport = ((FigureCanvas) getViewer().getControl()).getViewport(); int verticalValue = viewport.getVerticalRangeModel().getValue(); // System.out.println(verticalValue); if (verticalValue < getFigure().getBounds().y && verticalValue + 75 > getFigure().getBounds().y) { // System.out.println("Figure Location false : " + // getFigure().getBounds().y); return false; } else if (getFigure().getBounds().y < verticalValue) { return false; } // System.out.println("Figure Location true : " + // getFigure().getBounds().y); return true; }
/** * Initialize overview. */ protected void initializeOverview() { LightweightSystem lws = new J2DLightweightSystem(overview); RootEditPart rep = editor.getGraphicalViewer().getRootEditPart(); if (rep instanceof MainDesignerRootEditPart) { ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart) rep; thumbnail = new JSSScrollableThumbnail((Viewport) root.getFigure(), (MRoot)getViewer().getContents().getModel()); thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS)); lws.setContents(thumbnail); disposeListener = new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (thumbnail != null) { thumbnail.deactivate(); thumbnail = null; } } }; editor.getEditor().addDisposeListener(disposeListener); } lws.setControl(overview); }
protected void paintTickIntervals(Graphics g) { if (tickManager == null) { return; } Viewport viewport = TimelineUtils.getViewport(this); int scrollbarPosition = viewport.getHorizontalRangeModel().getValue(); int optimizeClipLeft = scrollbarPosition - 100; int optimizeClipRight = scrollbarPosition + viewport.getBounds().width + 100; SortedSet<Tick> ticks = tickManager.getTicks(calendar, g); g.setLineStyle(SWT.LINE_DOT); g.setForegroundColor(ColorConstants.black); paintIntervals(g, ticks, optimizeClipLeft, optimizeClipRight); }
/** * Finds the viewport of the given EditPart and scrolls it as requested. If * it can't be scrolled then leaves doit to be true so that the given * EditPart's ancestors might have a chance to scroll. * * @see org.eclipse.gef.MouseWheelHelper#handleMouseWheelScrolled(org.eclipse.swt.widgets.Event) */ public void handleMouseWheelScrolled(Event event) { Viewport viewport = findViewport(owner); if (viewport == null || !viewport.isShowing()) return; RangeModel rModel = viewport.getVerticalRangeModel(); if (rModel.getExtent() < (rModel.getMaximum() - rModel.getMinimum())) { int currentPos = rModel.getValue(); int scrollHeight = lineHeight; if (event.detail == SWT.SCROLL_PAGE) scrollHeight = pageHeight > lineHeight ? pageHeight : Math.max( lineHeight, viewport.getClientArea(Rectangle.SINGLETON).height - 26); scrollHeight *= event.count; viewport.setVerticalLocation(currentPos - scrollHeight); if (rModel.getValue() != currentPos) event.doit = false; } }
/** * @see org.eclipse.gef.editpolicies.SelectionEditPolicy#activate() */ public void activate() { super.activate(); // register listeners to all viewports in the host figure's path; // listeners // to the host figure itself will be registered within showFeedback() // and // unregistered within hideFeedback() for (Iterator iterator = ViewportUtilities.getViewportsPath( getHostFigureViewport(), ViewportUtilities.getRootViewport(getHostFigure())).iterator(); iterator .hasNext();) { Viewport viewport = (Viewport) iterator.next(); viewport.addPropertyChangeListener(viewportViewLocationChangeListener); } }
private static Rectangle getAbsoluteViewportArea(Viewport viewport) { Rectangle viewportParentBounds = viewport.getParent().getBounds() .getCopy(); int widthMax = viewport.getHorizontalRangeModel().getMaximum(); int widthMin = viewport.getHorizontalRangeModel().getMinimum(); int heightMax = viewport.getVerticalRangeModel().getMaximum(); int heightMin = viewport.getVerticalRangeModel().getMinimum(); viewportParentBounds .setSize(widthMax - widthMin, heightMax - heightMin); viewportParentBounds.translate(widthMin, heightMin); viewportParentBounds.translate(viewport.getViewLocation().getNegated()); viewport.getParent().translateToAbsolute(viewportParentBounds); return viewportParentBounds; }
private void disposeRulerViewer(GraphicalViewer viewer) { if (viewer == null) return; /* * There's a tie from the editor's range model to the RulerViewport (via * a listener) to the RulerRootEditPart to the RulerViewer. Break this * tie so that the viewer doesn't leak and can be garbage collected. */ dockLayoutPanel.remove(northPanel); dockLayoutPanel.remove(westPanel); dockLayoutPanel.forceLayout(); RangeModel rModel = new DefaultRangeModel(); Viewport port = ((FigureCanvas) viewer.getControl()).getViewport(); port.setHorizontalRangeModel(rModel); port.setVerticalRangeModel(rModel); rulerEditDomain.removeViewer(viewer); viewer.getRootEditPart().deactivate(); // viewer.getControl().dispose(); }
public void reveal(final IFigure figure) { Viewport viewport = canvas.getViewport(); Rectangle viewportBounds = viewport.getBounds().getCopy(); viewportBounds.translate(viewport.getViewLocation()); Rectangle figureBounds = figure.getBounds().getCopy(); figure.translateToAbsolute(figureBounds); figureBounds.translate(viewport.getViewLocation()); if (!viewportBounds.contains(figureBounds)) { int newX = viewportBounds.x; int newY = viewportBounds.y; if(viewportBounds.x > figureBounds.x) { newX = figureBounds.x; } else if(viewportBounds.x + viewportBounds.getRight().x < figureBounds.getRight().x) { newX = figureBounds.getRight().x - viewportBounds.width; } if(viewportBounds.y > figureBounds.y) { newY = figureBounds.y; } else if(viewportBounds.getBottom().y < figureBounds.getBottom().y) { newY = figureBounds.getBottom().y - viewportBounds.height; } canvas.scrollSmoothTo(newX, newY); } }
private void disposeRulerViewer( GraphicalViewer viewer ) { if ( viewer == null ) return; /* * There's a tie from the editor's range model to the RulerViewport (via * a listener) to the RulerRootEditPart to the RulerViewer. Break this * tie so that the viewer doesn't leak and can be garbage collected. */ RangeModel rModel = new DefaultRangeModel( ); Viewport port = ( (FigureCanvas) viewer.getControl( ) ).getViewport( ); port.setHorizontalRangeModel( new RulerDefaultRangeModel( rModel ) ); port.setVerticalRangeModel( new RulerDefaultRangeModel( rModel ) ); rulerEditDomain.removeViewer( viewer ); viewer.getControl( ).dispose( ); }
@Override protected Command getCreateBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointCreateCommand cmd = new BendpointCreateCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setLocation(p); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getDeleteBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointDeleteCommand cmd = new BendpointDeleteCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setLocation(p); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getCreateBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) request.getSource().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointCreateCommand cmd = new BendpointCreateCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setLocation(p); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getDeleteBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) request.getSource().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointDeleteCommand cmd = new BendpointDeleteCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setLocation(p); cmd.setIndex(request.getIndex()); return cmd; }
@Override protected Command getMoveBendpointCommand(BendpointRequest request) { Viewport vp = ((FigureCanvas) request.getSource().getViewer().getControl()).getViewport(); Point viewSize = vp.getViewLocation(); Point p = request.getLocation(); p.setX(p.x + viewSize.x); p.setY(p.y + viewSize.y); BendpointMoveCommand cmd = new BendpointMoveCommand(); cmd.setLink((Link) request.getSource().getModel()); cmd.setIndex(request.getIndex()); cmd.setNewLocation(p); return cmd; }
private void callHookRootFigure() { if (getFigureCanvas() == null) return; if (((GraphicalEditPart) getRootEditPart()).getFigure() instanceof Viewport) { getFigureCanvas().setViewport((Viewport) ((GraphicalEditPart) getRootEditPart()).getFigure()); } else { getFigureCanvas().setContents(((GraphicalEditPart) getRootEditPart()).getFigure()); } }
public void createEyeViewControl(Composite parent) { Canvas canvas = new Canvas(parent, SWT.NONE); canvas.setLayoutData(new GridData(GridData.FILL_BOTH)); LightweightSystem liSystem = new LightweightSystem(canvas); ScalableFreeformRootEditPart rootEditPart = ((ScalableFreeformRootEditPart) dbToolGefEditor.getGraphicalViewer().getRootEditPart()); ScrollableThumbnail thumbnail = new ScrollableThumbnail((Viewport) rootEditPart.getFigure()); thumbnail.setSource(rootEditPart.getLayer(LayerConstants.SCALABLE_LAYERS)); liSystem.setContents(thumbnail); }
public void createControl(Composite parent) { // create canvas and lws overview = new Canvas(parent, SWT.NONE); LightweightSystem lws = new LightweightSystem(overview); // create thumbnail thumbnail = new ScrollableThumbnail((Viewport) rootEditPart.getFigure()); thumbnail.setBorder(new MarginBorder(3)); thumbnail.setSource( rootEditPart.getLayer(LayerConstants.PRINTABLE_LAYERS)); lws.setContents(thumbnail); }
private void scrollTo(int ax, int ay) { Viewport viewport = ((FigureCanvas)viewer.getControl()).getViewport(); Rectangle vbounds = viewport.getBounds(); Point p = new Point(ax, ay); // target.translateToAbsolute(p); // TODO int x = p.x-vbounds.width/2; int y = p.y-vbounds.height/2; viewport.setHorizontalLocation(x); viewport.setVerticalLocation(y); }
public void createControl(Composite parent) { // create canvas and lws overview = new Canvas(parent, SWT.NONE); LightweightSystem lws = new LightweightSystem(overview); // create thumbnail thumbnail = new ScrollableThumbnail((Viewport) rootEditPart.getFigure()); thumbnail.setBorder(new MarginBorder(3)); thumbnail.setSource(rootEditPart .getLayer(LayerConstants.PRINTABLE_LAYERS)); lws.setContents(thumbnail); }
protected void initializeOverview() { LightweightSystem lws = new LightweightSystem(overview); if (rep instanceof ScalableFreeformRootEditPart) { ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart)rep; thumbnail = new ScrollableThumbnail((Viewport)root.getFigure()); thumbnail.setBorder(new MarginBorder(3)); thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS)); lws.setContents(thumbnail); } }
public void createControl(Composite parent) { control = new SashForm(parent, SWT.NONE); getViewer().createControl(parent); getViewer().setEditDomain(getEditDomain()); getSelectionSynchronizer().addViewer(getViewer()); Canvas canvas = new Canvas(control, SWT.BORDER); LightweightSystem lws = new LightweightSystem(canvas); thumbnail = new ScrollableThumbnail((Viewport) ((ScalableFreeformRootEditPart) getGraphicalViewer().getRootEditPart()).getFigure()); thumbnail.setSource(((ScalableFreeformRootEditPart) getGraphicalViewer().getRootEditPart()).getLayer(LayerConstants.PRINTABLE_LAYERS)); lws.setContents(thumbnail); disposeListener = new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (thumbnail != null) { thumbnail.deactivate(); thumbnail = null; } } }; getGraphicalViewer().getControl().addDisposeListener(disposeListener); }
/** * refreshNameHeaders * * @param viewport * void */ @SuppressWarnings("unchecked") public void refreshNameHeaders() { try { Viewport viewport = ((FigureCanvas) getViewer().getControl()).getViewport(); int verticalValue = viewport.getVerticalRangeModel().getValue(); if (verticalValue > 30) { for (int i = 0; i < nameHeaderList.size(); i++) { nameHeader = nameHeaderList.get(i); nameHeader.setVisible(true); } } else { for (int i = 0; i < nameHeaderList.size(); i++) { nameHeader = nameHeaderList.get(i); nameHeader.setVisible(false); } } List<EditPart> ediPartList = getChildren(); for (int i = 0; i < ediPartList.size(); i++) { if (ediPartList.get(i) instanceof LifeLineNameHeaderEditPart) { ((LifeLineNameHeaderEditPart) ediPartList.get(i)).refreshVisuals(); } } } catch (Exception e) { Log.error(UMLMessage.LABEL_SEQUENCE_DIAGRAM_EDIT_PART_REFRESH_NAME_HEADERS_ERROR + e); } }
/** * checkScroll * * 스크롤바 범위 밖으로 메시지를 이동 시킬때 스크롤을 강제적으로 이동시켜줌 * * @param request * void */ private void checkScroll(BendpointRequest request) { GraphicalViewer viewer = (GraphicalViewer) ((ScalableFreeformRootEditPart) request.getSource().getParent()).getViewer(); FigureCanvas canvas = (FigureCanvas) viewer.getControl(); ScrollBar verticalBar = canvas.getVerticalBar(); Viewport viewport = canvas.getViewport(); if (canvas.getSize().y < request.getLocation().y) { viewport.setVerticalLocation(request.getLocation().y - canvas.getSize().y + verticalBar.getSelection()); } else if (request.getLocation().y < 0) { viewport.setVerticalLocation(request.getLocation().y + verticalBar.getSelection()); } }
/** * Creates the graphical Thumbnail viewer. */ protected void createThumbnailViewer() { LightweightSystem lws = new LightweightSystem(_overview); ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) _graphicalViewer.getRootEditPart(); _thumbnail = new FixedScrollableThumbnail((Viewport) rootEditPart.getFigure()); _thumbnail.setBorder(new MarginBorder(3)); _thumbnail.setSource(rootEditPart.getLayer(LayerConstants.PRINTABLE_LAYERS)); lws.setContents(_thumbnail); }
public void reveal(IFigure target) { Viewport port = canvas.getViewport(); Rectangle exposeRegion = target.getBounds().getCopy(); target = target.getParent(); while (target != null && target != port) { target.translateToParent(exposeRegion); target = target.getParent(); } exposeRegion.expand(5, 5); Dimension viewportSize = port.getClientArea().getSize(); Point topLeft = exposeRegion.getTopLeft(); Point bottomRight = exposeRegion.getBottomRight().translate( viewportSize.getNegated()); Point finalLocation = new Point(); if (viewportSize.width < exposeRegion.width) finalLocation.x = Math.min(bottomRight.x, Math.max(topLeft.x, port.getViewLocation().x)); else finalLocation.x = Math.min(topLeft.x, Math.max(bottomRight.x, port.getViewLocation().x)); if (viewportSize.height < exposeRegion.height) finalLocation.y = Math.min(bottomRight.y, Math.max(topLeft.y, port.getViewLocation().y)); else finalLocation.y = Math.min(topLeft.y, Math.max(bottomRight.y, port.getViewLocation().y)); canvas.scrollSmoothTo(finalLocation.x, finalLocation.y); }