diff --git a/AUTHORS b/AUTHORS index 8a945de..6f09b40 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,4 @@ # Dock Spawn Authors Ali Akbar +Marius Volkhart diff --git a/lib/containers/fill_dock_container.dart b/lib/containers/fill_dock_container.dart index adbb587..7c89135 100644 --- a/lib/containers/fill_dock_container.dart +++ b/lib/containers/fill_dock_container.dart @@ -55,10 +55,10 @@ class FillDockContainer implements IDockContainer { } - int get width => element.clientWidth; + int get width => element.client.width; set width(int value) => element.style.width = "${value}px"; - int get height => element.clientHeight; + int get height => element.client.height; set height(int value) => element.style.height = "${value}px"; } diff --git a/lib/containers/panel_dock_container.dart b/lib/containers/panel_dock_container.dart index b3f6c5e..f39ecad 100644 --- a/lib/containers/panel_dock_container.dart +++ b/lib/containers/panel_dock_container.dart @@ -90,9 +90,9 @@ class PanelContainer implements IDockContainer { elementContentHost.classes.add("panel-content"); // set the size of the dialog elements based on the panel's size - int panelWidth = elementContent.clientWidth; - int panelHeight = elementContent.clientHeight; - int titleHeight = elementTitle.clientHeight; + int panelWidth = elementContent.client.width; + int panelHeight = elementContent.client.height; + int titleHeight = elementTitle.client.height; _setPanelDimensions(panelWidth, panelHeight + titleHeight); // Add the panel to the body @@ -179,7 +179,7 @@ class PanelContainer implements IDockContainer { elementPanel.style.width = "${_width}px"; - int titleBarHeight = elementTitle.clientHeight; + int titleBarHeight = elementTitle.client.height; int contentHeight = _height - titleBarHeight; elementContentHost.style.height = "${contentHeight}px"; elementContent.style.height = "${contentHeight}px"; diff --git a/lib/containers/splitter_dock_container.dart b/lib/containers/splitter_dock_container.dart index 20b1b50..f5e9dec 100644 --- a/lib/containers/splitter_dock_container.dart +++ b/lib/containers/splitter_dock_container.dart @@ -63,7 +63,7 @@ abstract class SplitterDockContainer implements IDockContainer { int get width { if (_cachedWidth == null) { - _cachedWidth = splitterPanel.panelElement.clientWidth; + _cachedWidth = splitterPanel.panelElement.client.width; } return _cachedWidth; // return splitterPanel.panelElement.clientWidth; @@ -71,7 +71,7 @@ abstract class SplitterDockContainer implements IDockContainer { int get height { if (_cachedHeight == null) { - _cachedHeight = splitterPanel.panelElement.clientHeight; + _cachedHeight = splitterPanel.panelElement.client.height; } return _cachedHeight; //splitterPanel.panelElement.clientHeight; // return splitterPanel.panelElement.clientHeight; diff --git a/lib/decorators/draggable_container.dart b/lib/decorators/draggable_container.dart index eb186c3..2c4f493 100644 --- a/lib/decorators/draggable_container.dart +++ b/lib/decorators/draggable_container.dart @@ -21,8 +21,8 @@ class DraggableContainer implements IDockContainer { containerType = delegate.containerType; mouseDownHandler = dragHandle.onMouseDown.listen(onMouseDown); - topLevelElement.style.marginLeft = "${topLevelElement.offsetLeft}"; - topLevelElement.style.marginTop = "${topLevelElement.offsetTop}"; + topLevelElement.style.marginLeft = "${topLevelElement.offset.left}"; + topLevelElement.style.marginTop = "${topLevelElement.offset.top}"; } void destroy() { @@ -76,7 +76,7 @@ class DraggableContainer implements IDockContainer { void onMouseDown(MouseEvent event) { _startDragging(event); - previousMousePosition = new Point2(event.pageX, event.pageY); + previousMousePosition = new Point2(event.page.x, event.page.y); if (mouseMoveHandler != null) { mouseMoveHandler.cancel(); mouseMoveHandler = null; @@ -114,7 +114,7 @@ class DraggableContainer implements IDockContainer { } void onMouseMove(MouseEvent event) { - Point2 currentMousePosition = new Point2(event.pageX, event.pageY); + Point2 currentMousePosition = new Point2(event.page.x, event.page.y); int dx = (currentMousePosition.x - previousMousePosition.x).toInt(); int dy = (currentMousePosition.y - previousMousePosition.y).toInt(); _performDrag(dx, dy); diff --git a/lib/decorators/resizable_container.dart b/lib/decorators/resizable_container.dart index 0d00c82..b686e1a 100644 --- a/lib/decorators/resizable_container.dart +++ b/lib/decorators/resizable_container.dart @@ -18,8 +18,8 @@ class ResizableContainer implements IDockContainer { ResizableContainer(this.dialog, this.delegate, this.topLevelElement) { containerType = delegate.containerType; - topLevelElement.style.marginLeft = "${topLevelElement.offsetLeft}"; - topLevelElement.style.marginTop = "${topLevelElement.offsetTop}"; + topLevelElement.style.marginLeft = "${topLevelElement.offset.left}"; + topLevelElement.style.marginTop = "${topLevelElement.offset.top}"; _buildResizeHandles(); } @@ -143,7 +143,7 @@ class ResizableContainer implements IDockContainer { // window.requestLayoutFrame(() { dockManager.suspendLayout(); - Point2 currentMousePosition = new Point2(e.pageX, e.pageY); + Point2 currentMousePosition = new Point2(e.page.x, e.page.y); int dx = (currentMousePosition.x - previousMousePosition.x).toInt(); int dy = (currentMousePosition.y - previousMousePosition.y).toInt(); _performDrag(handle, dx, dy); @@ -154,7 +154,7 @@ class ResizableContainer implements IDockContainer { } void onMouseDown(ResizeHandle handle, MouseEvent event) { - previousMousePosition = new Point2(event.pageX, event.pageY); + previousMousePosition = new Point2(event.page.x, event.page.y); if (handle.mouseMoveHandlerSub != null) { handle.mouseMoveHandlerSub.cancel(); } @@ -181,8 +181,8 @@ class ResizableContainer implements IDockContainer { var bounds = new BoundingBox(); bounds.left = getPixels(topLevelElement.style.marginLeft); bounds.top = getPixels(topLevelElement.style.marginTop); - bounds.width = topLevelElement.clientWidth; - bounds.height = topLevelElement.clientHeight; + bounds.width = topLevelElement.client.width; + bounds.height = topLevelElement.client.height; if (handle.east) _resizeEast(dx, bounds); if (handle.west) _resizeWest(dx, bounds); diff --git a/lib/dialog/dialog.dart b/lib/dialog/dialog.dart index a17da1f..6ce5798 100644 --- a/lib/dialog/dialog.dart +++ b/lib/dialog/dialog.dart @@ -35,7 +35,7 @@ class Dialog { mouseDownHandler = elementDialog.onMouseDown.listen(onMouseDown); - resize(panel.elementPanel.clientWidth, panel.elementPanel.clientHeight); + resize(panel.elementPanel.client.width, panel.elementPanel.client.height); bringToFront(); } diff --git a/lib/dock/dock_layout_engine.dart b/lib/dock/dock_layout_engine.dart index 459af06..f504598 100644 --- a/lib/dock/dock_layout_engine.dart +++ b/lib/dock/dock_layout_engine.dart @@ -116,12 +116,12 @@ class DockLayoutEngine { DockNode referenceParent = referenceNode.parent; // Get the dimensions of the reference node, for resizing later on - int referenceNodeWidth = referenceNode.container.containerElement.clientWidth; - int referenceNodeHeight = referenceNode.container.containerElement.clientHeight; + int referenceNodeWidth = referenceNode.container.containerElement.client.width; + int referenceNodeHeight = referenceNode.container.containerElement.client.height; // Get the dimensions of the reference node, for resizing later on - int referenceNodeParentWidth = referenceParent.container.containerElement.clientWidth; - int referenceNodeParentHeight = referenceParent.container.containerElement.clientHeight; + int referenceNodeParentWidth = referenceParent.container.containerElement.client.width; + int referenceNodeParentHeight = referenceParent.container.containerElement.client.height; // Replace the reference node with a new composite node with the reference and new node as it's children IDockContainer compositeContainer = _createDockContainer(direction, newNode, referenceNode); @@ -159,14 +159,14 @@ class DockLayoutEngine { } // force resize the panel - int containerWidth = newNode.container.containerElement.clientWidth; - int containerHeight = newNode.container.containerElement.clientHeight; + int containerWidth = newNode.container.containerElement.client.width; + int containerHeight = newNode.container.containerElement.client.height; newNode.container.resize(containerWidth, containerHeight); } void _forceResizeCompositeContainer(IDockContainer container) { - int width = container.containerElement.clientWidth; - int height = container.containerElement.clientHeight; + int width = container.containerElement.client.width; + int height = container.containerElement.client.height; container.resize(width, height); } @@ -200,10 +200,10 @@ class DockLayoutEngine { // TODO: Create a tab handle highlight to show that it's going to be docked in a tab Element targetElement = referenceNode.container.containerElement; Rectangle bounds = new Rectangle(); - bounds.x = targetElement.offsetLeft; - bounds.y = targetElement.offsetTop; - bounds.width = targetElement.clientWidth; - bounds.height= targetElement.clientHeight; + bounds.x = targetElement.offset.left; + bounds.y = targetElement.offset.top; + bounds.width = targetElement.client.width; + bounds.height= targetElement.client.height; return bounds; } @@ -255,13 +255,13 @@ class DockLayoutEngine { Rectangle bounds = new Rectangle(); if (direction == "vertical") { - bounds.x = compositeNode.container.containerElement.offsetLeft; - bounds.y = compositeNode.container.containerElement.offsetTop + targetPanelStart; + bounds.x = compositeNode.container.containerElement.offset.left; + bounds.y = compositeNode.container.containerElement.offset.top + targetPanelStart; bounds.width = compositeNode.container.width; bounds.height = targetPanelSize; } else if (direction == "horizontal") { - bounds.x = compositeNode.container.containerElement.offsetLeft + targetPanelStart; - bounds.y = compositeNode.container.containerElement.offsetTop; + bounds.x = compositeNode.container.containerElement.offset.left + targetPanelStart; + bounds.y = compositeNode.container.containerElement.offset.top; bounds.width = targetPanelSize; bounds.height = compositeNode.container.height; } diff --git a/lib/dock/dock_manager.dart b/lib/dock/dock_manager.dart index a05fe76..3e4656d 100644 --- a/lib/dock/dock_manager.dart +++ b/lib/dock/dock_manager.dart @@ -27,7 +27,7 @@ class DockManager implements DialogEventListener { context.model.documentManagerNode = documentNode; setRootNode(context.model.rootNode); // Resize the layout - resize(element.clientWidth, element.clientHeight); + resize(element.client.width, element.client.height); dockWheel = new DockWheel(this); layoutEngine = new DockLayoutEngine(this); @@ -40,7 +40,7 @@ class DockManager implements DialogEventListener { } void invalidate() { - resize(element.clientWidth, element.clientHeight); + resize(element.client.width, element.client.height); } void resize(int width, int height) { @@ -75,7 +75,7 @@ class DockManager implements DialogEventListener { void onDialogDragStarted(Dialog sender, MouseEvent e) { - dockWheel.activeNode = _findNodeOnPoint(e.pageX, e.pageY); + dockWheel.activeNode = _findNodeOnPoint(e.page.x, e.page.y); dockWheel.activeDialog = sender; dockWheel.showWheel(); if (mouseMoveHandler != null) { @@ -95,7 +95,7 @@ class DockManager implements DialogEventListener { } void onMouseMoved(MouseEvent e) { - dockWheel.activeNode = _findNodeOnPoint(e.pageX, e.pageY); + dockWheel.activeNode = _findNodeOnPoint(e.page.x, e.page.y); } /** @@ -218,13 +218,13 @@ class DockManager implements DialogEventListener { var dialog = new Dialog(node.container, this); // Adjust the relative position - num dialogWidth = dialog.elementDialog.clientWidth; + num dialogWidth = dialog.elementDialog.client.width; if (dragOffset.x > dialogWidth) { dragOffset.x = 0.75 * dialogWidth; } dialog.setPosition( - event.pageX - dragOffset.x, - event.pageY - dragOffset.y); + event.page.x - dragOffset.x, + event.page.y - dragOffset.y); dialog.draggable.onMouseDown(event); return dialog; diff --git a/lib/dock/dock_model.dart b/lib/dock/dock_model.dart index d20d06b..d55577b 100644 --- a/lib/dock/dock_model.dart +++ b/lib/dock/dock_model.dart @@ -59,8 +59,8 @@ class DockNode { childNode.parent = this; int referenceIndex = children.indexOf(referenceNode); - List preList = children.getRange(0, referenceIndex); - List postList = children.getRange(referenceIndex + 1, children.length - (referenceIndex + 1)); + List preList = children.sublist(0, referenceIndex); + List postList = children.sublist(referenceIndex + 1, children.length); children = new List(); children.addAll(preList); diff --git a/lib/dock/dock_wheel.dart b/lib/dock/dock_wheel.dart index 17289b2..5e4e35f 100644 --- a/lib/dock/dock_wheel.dart +++ b/lib/dock/dock_wheel.dart @@ -69,20 +69,20 @@ class DockWheel { return; } Element element = activeNode.container.containerElement; - int containerWidth = element.clientWidth; - int containerHeight = element.clientHeight; - int baseX = containerWidth ~/ 2 + element.offsetLeft; - int baseY = containerHeight ~/ 2 + element.offsetTop; + int containerWidth = element.client.width; + int containerHeight = element.client.height; + int baseX = containerWidth ~/ 2 + element.offset.left; + int baseY = containerHeight ~/ 2 + element.offset.top; elementMainWheel.style.left = "${baseX}px"; elementMainWheel.style.top = "${baseY}px"; // The positioning of the main dock wheel buttons is done automatically through CSS // Dynamically calculate the positions of the buttons on the extreme sides of the dock manager num sideMargin = 20; - num dockManagerWidth = dockManager.element.clientWidth; - num dockManagerHeight = dockManager.element.clientHeight; - num dockManagerOffsetX = dockManager.element.offsetLeft; - num dockManagerOffsetY = dockManager.element.offsetTop; + num dockManagerWidth = dockManager.element.client.width; + num dockManagerHeight = dockManager.element.client.height; + num dockManagerOffsetX = dockManager.element.offset.left; + num dockManagerOffsetY = dockManager.element.offset.top; elementMainWheel.remove(); elementSideWheel.remove(); @@ -98,8 +98,8 @@ class DockWheel { void _setWheelButtonPosition(String wheelId, num left, num top) { DockWheelItem item = wheelItems[wheelId]; - num itemHalfWidth = item.element.clientWidth / 2; - num itemHalfHeight = item.element.clientHeight / 2; + num itemHalfWidth = item.element.client.width / 2; + num itemHalfHeight = item.element.client.height / 2; int x = (left - itemHalfWidth).toInt(); int y = (top - itemHalfHeight).toInt(); diff --git a/lib/splitter/splitter_bar.dart b/lib/splitter/splitter_bar.dart index 82e6dd1..f7e4ff3 100644 --- a/lib/splitter/splitter_bar.dart +++ b/lib/splitter/splitter_bar.dart @@ -37,8 +37,8 @@ class SplitterBar { readyToProcessNextDrag = false; var dockManager = previousContainer.dockManager; dockManager.suspendLayout(); - int dx = e.pageX - previousMouseEvent.pageX; - int dy = e.pageY - previousMouseEvent.pageY; + int dx = e.page.x - previousMouseEvent.page.x; + int dy = e.page.y - previousMouseEvent.page.y; _performDrag(dx, dy); previousMouseEvent = e; readyToProcessNextDrag = true; @@ -46,10 +46,10 @@ class SplitterBar { } void _performDrag(int dx, int dy) { - int previousWidth = previousContainer.containerElement.clientWidth; - int previousHeight = previousContainer.containerElement.clientHeight; - int nextWidth = nextContainer.containerElement.clientWidth; - int nextHeight = nextContainer.containerElement.clientHeight; + int previousWidth = previousContainer.containerElement.client.width; + int previousHeight = previousContainer.containerElement.client.height; + int nextWidth = nextContainer.containerElement.client.width; + int nextHeight = nextContainer.containerElement.client.height; int previousPanelSize = stackedVertical ? previousHeight : previousWidth; int nextPanelSize = stackedVertical ? nextHeight : nextWidth; diff --git a/lib/splitter/splitter_panel.dart b/lib/splitter/splitter_panel.dart index f5df433..58ec2eb 100644 --- a/lib/splitter/splitter_panel.dart +++ b/lib/splitter/splitter_panel.dart @@ -71,9 +71,9 @@ class SplitterPanel { * The percentage is specified in [ratio] and is between 0..1 */ void setContainerRatio(IDockContainer container, num ratio) { - num splitPanelSize = stackedVertical ? panelElement.clientHeight : panelElement.clientWidth; + num splitPanelSize = stackedVertical ? panelElement.client.height : panelElement.client.width; num newContainerSize = splitPanelSize * ratio; - int barSize = stackedVertical ? spiltterBars[0].barElement.clientHeight : spiltterBars[0].barElement.clientWidth; + int barSize = stackedVertical ? spiltterBars[0].barElement.client.height : spiltterBars[0].barElement.client.width; num otherPanelSizeQuota = splitPanelSize - newContainerSize - barSize * spiltterBars.length; num otherPanelScaleMultipler = otherPanelSizeQuota / splitPanelSize; @@ -81,7 +81,7 @@ class SplitterPanel { childContainers.forEach((child) { num size; if (child != container) { - size = stackedVertical ? child.containerElement.clientHeight : child.containerElement.clientWidth; + size = stackedVertical ? child.containerElement.client.height : child.containerElement.client.width; size *= otherPanelScaleMultipler; } else { size = newContainerSize; @@ -129,7 +129,7 @@ class SplitterPanel { }); // Get the thickness of the bar - int barSize = stackedVertical ? spiltterBars[0].barElement.clientHeight : spiltterBars[0].barElement.clientWidth; + int barSize = stackedVertical ? spiltterBars[0].barElement.client.height : spiltterBars[0].barElement.client.width; // Find out how much space existing child containers will take after being resized (excluding the splitter bars) int targetTotalChildPanelSize = stackedVertical ? height : width; @@ -144,8 +144,8 @@ class SplitterPanel { for (int i = 0; i < childContainers.length; i++) { var child = childContainers[i]; int original = stackedVertical ? - child.containerElement.clientHeight : - child.containerElement.clientWidth; + child.containerElement.client.height : + child.containerElement.client.width; int newSize = (original * scaleMultiplier).toInt(); updatedTotalChildPanelSize += newSize; diff --git a/lib/tab/tab_host.dart b/lib/tab/tab_host.dart index b50cd02..a00a5fd 100644 --- a/lib/tab/tab_host.dart +++ b/lib/tab/tab_host.dart @@ -72,8 +72,8 @@ class TabHost { hostElement.style.width = "${width}px"; hostElement.style.height = "${height}px"; - int tabHeight = tabListElement.clientHeight; - int separatorHeight = separatorElement.clientHeight; + int tabHeight = tabListElement.client.height; + int separatorHeight = separatorElement.client.height; int contentHeight = height - tabHeight - separatorHeight; contentElement.style.height = "${contentHeight}px"; diff --git a/lib/tab/tab_page.dart b/lib/tab/tab_page.dart index 5704f16..f841a2d 100644 --- a/lib/tab/tab_page.dart +++ b/lib/tab/tab_page.dart @@ -42,8 +42,8 @@ class TabPage { if (selected) { host.contentElement.nodes.add(containerElement); // force a resize again - int width = host.contentElement.clientWidth; - int height = host.contentElement.clientHeight; + int width = host.contentElement.client.width; + int height = host.contentElement.client.height; container.resize(width, height); } else { containerElement.remove(); diff --git a/lib/utils/dock_utils.dart b/lib/utils/dock_utils.dart index e3c29af..e6980d1 100644 --- a/lib/utils/dock_utils.dart +++ b/lib/utils/dock_utils.dart @@ -7,12 +7,12 @@ int getPixels(String pixels) { Point2 getMousePosition(MouseEvent e, Element element) { - int parentOffsetX = element.offsetLeft; - int parentOffsetY = element.offsetTop; - int parentWidth = element.clientWidth; - int parentHeight = element.clientHeight; - int x = e.offsetX - parentOffsetX; - int y = e.offsetX - parentOffsetY; + int parentOffsetX = element.offset.left; + int parentOffsetY = element.offset.top; + int parentWidth = element.client.width; + int parentHeight = element.client.height; + int x = e.offset.x - parentOffsetX; + int y = e.offset.x - parentOffsetY; return new Point2(x, y); } @@ -26,10 +26,10 @@ void enableGlobalTextSelection() { bool isPointInsideNode(int px, int py, DockNode node) { Element element = node.container.containerElement; - int x = element.offsetLeft; - int y = element.offsetTop; - int width = element.clientWidth; - int height = element.clientHeight; + int x = element.offset.left; + int y = element.offset.top; + int width = element.client.width; + int height = element.client.height; return (px >= x && px <= x + width && py >= y && py <= y + height); } diff --git a/lib/utils/undock_initiator.dart b/lib/utils/undock_initiator.dart index 9e53b1b..e5e8783 100644 --- a/lib/utils/undock_initiator.dart +++ b/lib/utils/undock_initiator.dart @@ -55,7 +55,7 @@ class UndockInitiator { _cancelSubscription(mouseMoveHandler); mouseUpHandler = window.onMouseUp.listen(onMouseUp); mouseMoveHandler = window.onMouseMove.listen(onMouseMove); - dragStartPosition = new Point2(e.pageX, e.pageY); + dragStartPosition = new Point2(e.page.x, e.page.y); } } void onMouseUp(MouseEvent e) { @@ -65,7 +65,7 @@ class UndockInitiator { mouseMoveHandler = null; } void onMouseMove(MouseEvent e) { - Point2 position = new Point2(e.pageX, e.pageY); + Point2 position = new Point2(e.page.x, e.page.y); num dx = position.x - dragStartPosition.x; num dy = position.y - dragStartPosition.y; num distance = sqrt(dx * dx + dy * dy); @@ -77,8 +77,8 @@ class UndockInitiator { } void _requestUndock(MouseEvent e) { - num dragOffsetX = dragStartPosition.x - element.offsetLeft; - num dragOffsetY = dragStartPosition.y - element.offsetTop; + num dragOffsetX = dragStartPosition.x - element.offset.left; + num dragOffsetY = dragStartPosition.y - element.offset.top; Point2 dragOffset = new Point2(dragOffsetX, dragOffsetY); listener(e, dragOffset); } diff --git a/web/demos/dock_spawn_demo_ide/ide/panels/editor_panel.dart b/web/demos/dock_spawn_demo_ide/ide/panels/editor_panel.dart index 5d86c20..19aaa9f 100644 --- a/web/demos/dock_spawn_demo_ide/ide/panels/editor_panel.dart +++ b/web/demos/dock_spawn_demo_ide/ide/panels/editor_panel.dart @@ -20,8 +20,8 @@ class EditorPanel extends PanelContainer { void resize(int _width, int _height) { super.resize(_width, _height); - int clientWidth = elementContent.clientWidth; - int clientHeight = elementContent.clientHeight; + int clientWidth = elementContent.client.width; + int clientHeight = elementContent.client.height; codeMirrorBase.style.width = "${clientWidth}px"; codeMirrorBase.style.height = "${clientHeight}px"; diff --git a/web/demos/dock_spawn_demo_ide/ide/spawn_ide.dart b/web/demos/dock_spawn_demo_ide/ide/spawn_ide.dart index 73c5e2e..13d03a7 100644 --- a/web/demos/dock_spawn_demo_ide/ide/spawn_ide.dart +++ b/web/demos/dock_spawn_demo_ide/ide/spawn_ide.dart @@ -42,7 +42,7 @@ class SpawnIDE { } void onResized(Event event) { - int headerHeight = header.clientHeight; + int headerHeight = header.client.height; dockManager.resize(window.innerWidth, window.innerHeight - headerHeight); // dockManager.resize(600, 400); }