Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Live development bugfixes #2819

Merged
merged 5 commits into from
Feb 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/LiveDevelopment/Agents/DOMAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ define(function DOMAgent(require, exports, module) {
// WebInspector Event: Page.frameNavigated
function _onFrameNavigated(event, res) {
// res = {frame}
exports.url = _cleanURL(res.frame.url);
if (!res.frame.parentId) {
exports.url = _cleanURL(res.frame.url);
}
}

// WebInspector Event: DOM.documentUpdated
Expand Down Expand Up @@ -291,6 +293,9 @@ define(function DOMAgent(require, exports, module) {
if (n.location > node.location) {
n.location += delta;
}
if (n.closeLocation !== undefined && n.closeLocation > node.location) {
n.closeLocation += delta;
}
});
}
}
Expand Down
48 changes: 31 additions & 17 deletions src/LiveDevelopment/Agents/RemoteFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ function RemoteFunctions(experimental) {
var HIGHLIGHT_CLASSNAME = "__brackets-ld-highlight",
KEEP_ALIVE_TIMEOUT = 3000; // Keep alive timeout value, in milliseconds

// determine whether an event should be processed for Live Development
function _validEvent(event) {
if (navigator.platform.substr(0, 3) === "Mac") {
// Mac
return event.metaKey;
} else {
// Windows
return event.ctrlKey;
}
}

// determine the color for a type
function _typeColor(type, highlight) {
switch (type) {
Expand Down Expand Up @@ -297,6 +308,12 @@ function RemoteFunctions(experimental) {
for (i = 0; i < highlights.length; i++) {
body.removeChild(highlights[i]);
}

if (this.trigger) {
for (i = 0; i < this.elements.length; i++) {
_trigger(this.elements[i], "highlight", 0);
}
}

this.elements = [];
},
Expand Down Expand Up @@ -340,17 +357,15 @@ function RemoteFunctions(experimental) {
/** Event Handlers ***********************************************************/

function onMouseOver(event) {
if (!event.metaKey) {
return;
if (_validEvent(event)) {
_localHighlight.add(event.target, true);
}
_localHighlight.add(event.target, true);
}

function onMouseOut(event) {
if (!event.metaKey) {
return;
if (_validEvent(event)) {
_localHighlight.clear();
}
_localHighlight.clear();
}

function onMouseMove(event) {
Expand All @@ -359,20 +374,19 @@ function RemoteFunctions(experimental) {
}

function onClick(event) {
if (!event.metaKey) {
return;
}
event.preventDefault();
event.stopPropagation();
if (event.altKey) {
_toggleEditor(event.target);
} else {
_toggleMenu(event.target);
if (_validEvent(event)) {
event.preventDefault();
event.stopPropagation();
if (event.altKey) {
_toggleEditor(event.target);
} else {
_toggleMenu(event.target);
}
}
}

function onKeyUp(event) {
if (_setup && !event.metaKey) {
if (_setup && !_validEvent(event)) {
document.removeEventListener("keyup", onKeyUp);
document.removeEventListener("mouseover", onMouseOver);
document.removeEventListener("mouseout", onMouseOut);
Expand All @@ -385,7 +399,7 @@ function RemoteFunctions(experimental) {
}

function onKeyDown(event) {
if (!_setup && event.metaKey) {
if (!_setup && _validEvent(event)) {
document.addEventListener("keyup", onKeyUp);
document.addEventListener("mouseover", onMouseOver);
document.addEventListener("mouseout", onMouseOut);
Expand Down
Loading