|
|
|
|
@ -618,8 +618,16 @@ |
|
|
|
|
} |
|
|
|
|
self._setStatus('已选中 ' + label, true); |
|
|
|
|
if (self.panels.inspector) self.panels.inspector.loadUuid(res.uuid); |
|
|
|
|
if (self.panels.hierarchy) self.panels.hierarchy.setSelectedUuid(res.uuid); |
|
|
|
|
self._setPickHighlight(res.rect || null); |
|
|
|
|
if (!res.rect && self.bridge) { |
|
|
|
|
self.bridge.call('pick.getRect').then(function (rect) { |
|
|
|
|
self._setPickHighlight(rect); |
|
|
|
|
}).catch(function () { /* */ }); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
self._setStatus('未命中 (' + Math.round(gameX) + ',' + Math.round(gameY) + ')', false); |
|
|
|
|
self._setPickHighlight(null); |
|
|
|
|
} |
|
|
|
|
}).catch(function (err) { |
|
|
|
|
self._setStatus('选取失败', false); |
|
|
|
|
@ -632,6 +640,36 @@ |
|
|
|
|
this._pickCaptureBound = true; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 预览区绿色半透明高亮(壳层,盖在游戏 iframe 上)。 |
|
|
|
|
* @param {{left:number,top:number,width:number,height:number}|null} rect 游戏视口坐标 |
|
|
|
|
*/ |
|
|
|
|
PreviewWorkbenchHost.prototype._setPickHighlight = function (rect) { |
|
|
|
|
var el = document.getElementById('pw-pick-highlight'); |
|
|
|
|
if (!el) return; |
|
|
|
|
if (!rect || !(rect.width > 0) || !(rect.height > 0)) { |
|
|
|
|
el.hidden = true; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
var host = document.getElementById('pw-game-host'); |
|
|
|
|
var ox = 0; |
|
|
|
|
var oy = 0; |
|
|
|
|
if (host) { |
|
|
|
|
var hr = host.getBoundingClientRect(); |
|
|
|
|
var iframe = this._iframe; |
|
|
|
|
if (iframe) { |
|
|
|
|
var ir = iframe.getBoundingClientRect(); |
|
|
|
|
ox = ir.left - hr.left; |
|
|
|
|
oy = ir.top - hr.top; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
el.hidden = false; |
|
|
|
|
el.style.left = (ox + (rect.left || 0)) + 'px'; |
|
|
|
|
el.style.top = (oy + (rect.top || 0)) + 'px'; |
|
|
|
|
el.style.width = Math.max(2, rect.width || 0) + 'px'; |
|
|
|
|
el.style.height = Math.max(2, rect.height || 0) + 'px'; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
PreviewWorkbenchHost.prototype._setStatus = function (text, ok) { |
|
|
|
|
var el = document.getElementById('pw-engine-status'); |
|
|
|
|
if (!el) return; |
|
|
|
|
|